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."))
At the moment the API for get_vnc_console is:
def get_vnc_ console( self, req, id, body): 'nova.context' ]
context. can(rc_ policies. BASE_POLICY_ NAME)
"""Get text console output."""
context = req.environ[
# 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) api.get_ vnc_console( context,
instance,
console_ type) ConsoleTypeUnav ailable as e: HTTPBadRequest( explanation= e.format_ message( )) InstanceUnknown Cell,
exception. InstanceNotFoun d) as e: HTTPNotFound( explanation= e.format_ message( )) InstanceNotRead y as e: HTTPConflict( explanation= e.format_ message( )) rror:
common. raise_feature_ not_supported( )
try:
output = self.compute_
except exception.
raise webob.exc.
except (exception.
raise webob.exc.
except exception.
raise webob.exc.
except NotImplementedE
The nova-powervm driver method is:
def get_vnc_ console( self, context, instance): instance. Instance type.ConsoleVNC
self._ log_operation( 'get_vnc_ console' , instance) pvm_uuid( instance)
"""Get connection info for a vnc console.
:param context: security context
:param instance: nova.objects.
:return: An instance of console.
"""
lpar_uuid = vm.get_
# Build the connection to the VNC. server_ proxyclient_ address
use_x509_ auth = CONF.powervm. vnc_use_ x509_auth vnc_ca_ certs vnc_server_ key vnc_server_ cert 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) HttpNotFound: InstanceNotFoun d(instance_ id=instance. uuid)
LOG. exception( "Unable to open console.", instance=instance) InternalError( err=_(" Unable to open console."))
host = CONF.vnc.
ca_certs = CONF.powervm.
server_key = CONF.powervm.
server_cert = CONF.powervm.
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.
except pvm_exc.
raise exception.
except pvm_exc.Error:
# Otherwise wrapper the error in an exception that can be handled
raise exception.
InternalError isn't handled by the API.