Comment 0 for bug 1724084

Revision history for this message
Matt Rabe (mdrabe) wrote :

At the moment the API for get_vnc_console is:

    def get_vnc_console(self, req, id, body):
        """Get text console output."""
        context = req.environ['nova.context']
        context.can(rc_policies.BASE_POLICY_NAME)

        # If type is not supplied or unknown, get_vnc_console below will cope
        console_type = body['os-getVNCConsole'].get('type')

        instance = common.get_instance(self.compute_api, context, id)
        try:
            output = self.compute_api.get_vnc_console(context,
                                                      instance,
                                                      console_type)
        except exception.ConsoleTypeUnavailable as e:
            raise webob.exc.HTTPBadRequest(explanation=e.format_message())
        except (exception.InstanceUnknownCell,
                     exception.InstanceNotFound) as e:
            raise webob.exc.HTTPNotFound(explanation=e.format_message())
        except exception.InstanceNotReady as e:
            raise webob.exc.HTTPConflict(explanation=e.format_message())
        except NotImplementedError:
            common.raise_feature_not_supported()

The nova-powervm driver method is:

    def get_vnc_console(self, context, instance):
        """Get connection info for a vnc console.
        :param context: security context
        :param instance: nova.objects.instance.Instance
        :return: An instance of console.type.ConsoleVNC
        """
        self._log_operation('get_vnc_console', instance)
        lpar_uuid = vm.get_pvm_uuid(instance)

        # Build the connection to the VNC.
        host = CONF.vnc.server_proxyclient_address
        use_x509_auth = CONF.powervm.vnc_use_x509_auth
        ca_certs = CONF.powervm.vnc_ca_certs
        server_key = CONF.powervm.vnc_server_key
        server_cert = CONF.powervm.vnc_server_cert
        try:
            # Open up a remote vterm with the host and certificates configured
            # This will only use TLS if the use_x509_auth is set to True
            port = pvm_vterm.open_remotable_vnc_vterm(
                self.adapter, lpar_uuid, host, vnc_path=lpar_uuid,
                use_x509_auth=use_x509_auth, ca_certs=ca_certs,
                server_cert=server_cert, server_key=server_key)
        except pvm_exc.HttpNotFound:
            raise exception.InstanceNotFound(instance_id=instance.uuid)
        except pvm_exc.Error:
            # Otherwise wrapper the error in an exception that can be handled
            LOG.exception("Unable to open console.", instance=instance)
            raise exception.InternalError(err=_("Unable to open console."))

InternalError isn't handled by the API.