def rdp(request, instance_id): try: instance = api.nova.server_get(request, instance_id) console_url = project_console.get_console(request, 'RDP', instance)[1] return shortcuts.redirect(console_url) except Exception: redirect = reverse("horizon:f5services:f5adc:index") msg = _('Unable to get RDP console for instance "%s".') % instance_id exceptions.handle(request, msg, redirect=redirect)
def auto_console(request, instance_id): console_type = getattr(settings, 'CONSOLE_TYPE', 'AUTO') try: instance = api.nova.server_get(request, instance_id) console_url = project_console.get_console(request, console_type, instance)[1] return shortcuts.redirect(console_url) except Exception: redirect = reverse("horizon:f5services:f5adc:index") msg = _('Unable to get console for instance "%s".') % instance_id exceptions.handle(request, msg, redirect=redirect)
def get_context_data(self, request): instance = self.tab_group.kwargs['instance'] console_type = getattr(settings, 'CONSOLE_TYPE', 'AUTO') console_url = None try: console_type, console_url = console.get_console( request, console_type, instance) # For serial console, the url is different from VNC, etc. # because it does not include params for title and token if console_type == "SERIAL": console_url = reverse('horizon:f5services:f5adc:serial', args=[instance.id]) except exceptions.NotAvailable: exceptions.handle(request, ignore=True, force_log=True) return { 'console_url': console_url, 'instance_id': instance.id, 'console_type': console_type }
def get_context_data(self, **kwargs): context = super(SerialConsoleView, self).get_context_data(**kwargs) instance = None try: instance = api.nova.server_get(self.request, self.kwargs['instance_id']) except Exception: context["error_message"] = _( "Cannot find instance %s.") % self.kwargs['instance_id'] # name is unknown, so leave it blank for the window title # in full-screen mode, so only the instance id is shown. context['page_title'] = self.kwargs['instance_id'] return context context['page_title'] = "%s (%s)" % (instance.name, instance.id) try: console_url = project_console.get_console(self.request, "SERIAL", instance)[1] context["console_url"] = console_url context["protocols"] = "['binary', 'base64']" except exceptions.NotAvailable: context["error_message"] = _("Cannot get console for instance %s." ) % self.kwargs['instance_id'] return context