Merge "Fix get_vnc_console race."
This commit is contained in:
commit
a10be151ad
@ -1627,6 +1627,9 @@ class API(base.Base):
|
||||
@wrap_check_policy
|
||||
def get_vnc_console(self, context, instance, console_type):
|
||||
"""Get a url to an instance Console."""
|
||||
if not instance['host']:
|
||||
raise exception.InstanceNotReady(instance=instance)
|
||||
|
||||
connect_info = self.compute_rpcapi.get_vnc_console(context,
|
||||
instance=instance, console_type=console_type)
|
||||
|
||||
|
@ -3899,6 +3899,15 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
fake_instance, fake_console_type)
|
||||
self.assertEqual(console, {'url': 'fake_console_url'})
|
||||
|
||||
def test_get_vnc_console_no_host(self):
|
||||
instance = self._create_fake_instance(params={'host': ''})
|
||||
|
||||
self.assertRaises(exception.InstanceNotReady,
|
||||
self.compute_api.get_vnc_console,
|
||||
self.context, instance, 'novnc')
|
||||
|
||||
db.instance_destroy(self.context, instance['uuid'])
|
||||
|
||||
def test_console_output(self):
|
||||
fake_instance = {'uuid': 'fake_uuid',
|
||||
'host': 'fake_compute_host'}
|
||||
|
Loading…
Reference in New Issue
Block a user