get_vnc_console in the driver raises an InternalError exception which isn't handled by the API

Bug #1724084 reported by Matt Rabe on 2017-10-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nova-powervm
Undecided
Tyler Blakeslee

Bug Description

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, so you get "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible. <class 'InternalError_Remote'>"

Matt Rabe (mdrabe) wrote :

Looking at subclassing one of the handled exceptions and raising that from the driver in place of InternalError.

Changed in nova-powervm:
assignee: nobody → Matt Rabe (mdrabe)
Changed in nova-powervm:
assignee: Matt Rabe (mdrabe) → Tyler Blakeslee (tblakes)
description: updated
Changed in nova-powervm:
status: New → In Progress

Reviewed: https://review.openstack.org/513833
Committed: https://git.openstack.org/cgit/openstack/nova-powervm/commit/?id=f0b4f6f95131e7a4c5a01345c1f4904342353834
Submitter: Zuul
Branch: master

commit f0b4f6f95131e7a4c5a01345c1f4904342353834
Author: Tyler Blakeslee <email address hidden>
Date: Fri Oct 20 15:09:37 2017 -0400

    Raise catachable error when VNC terminal fails to open.

    Closes-Bug: #1724084

    Change-Id: I29171925d5c59b2f4dbf0c6f2a731aa196ca3b72

Changed in nova-powervm:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/514468
Committed: https://git.openstack.org/cgit/openstack/nova-powervm/commit/?id=5bf987ceed77794caa4b3904b04fa263993d6787
Submitter: Zuul
Branch: stable/pike

commit 5bf987ceed77794caa4b3904b04fa263993d6787
Author: Tyler Blakeslee <email address hidden>
Date: Fri Oct 20 15:09:37 2017 -0400

    Raise catachable error when VNC terminal fails to open.

    Closes-Bug: #1724084

    Change-Id: I29171925d5c59b2f4dbf0c6f2a731aa196ca3b72
    (cherry picked from commit: 42468a2ee0dd17beabd4188655aa4952f0ac94f6)

tags: added: in-stable-pike
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers