Raise catachable error when VNC terminal fails to open.
Closes-Bug: #1724084
Change-Id: I29171925d5c59b2f4dbf0c6f2a731aa196ca3b72
(cherry picked from commit: 42468a2ee0
)
This commit is contained in:
parent
62529caddd
commit
5bf987ceed
|
@ -1673,7 +1673,7 @@ class TestPowerVMDriver(test.TestCase):
|
|||
|
||||
# Failure
|
||||
mock_vterm.side_effect = pvm_exc.VNCBasedTerminalFailedToOpen(err='xx')
|
||||
self.assertRaises(exc.InternalError, self.drv.get_vnc_console,
|
||||
self.assertRaises(exc.ConsoleTypeUnavailable, self.drv.get_vnc_console,
|
||||
mock.ANY, self.inst)
|
||||
|
||||
# 404
|
||||
|
|
|
@ -1734,10 +1734,17 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||
server_cert=server_cert, server_key=server_key)
|
||||
except pvm_exc.HttpNotFound:
|
||||
raise exception.InstanceNotFound(instance_id=instance.uuid)
|
||||
except pvm_exc.Error:
|
||||
except pvm_exc.Error as exc:
|
||||
# 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."))
|
||||
msg = (_("VNC based terminal for instance %(instance_name)s "
|
||||
"failed to open: %(exc_msg)s")
|
||||
% {'instance_name': instance.name,
|
||||
'exc_msg': exc.args[0]})
|
||||
# Need to raise ConsoleTypeUnavailable with overwritten message
|
||||
# because otherwise the exception will not be caught. It is
|
||||
# disallowed to send a non-nova exception over the wire.
|
||||
raise exception.ConsoleTypeUnavailable(msg)
|
||||
|
||||
# Note that the VNC viewer will wrap the internal_access_path with
|
||||
# the HTTP content.
|
||||
|
|
Loading…
Reference in New Issue