From fa16d173938b30af4e1cc6b312a75b12aff6c424 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 17 Aug 2012 15:21:36 -0400 Subject: Fix get_vnc_console race. There exists a window between a server create is done and when the host is assigned by the scheduler that a request to get the vnc console will result in a 500 error. This patch adds a check in the compute API to ensure that the instance has a host assigned before try to execute a rpc on the compute node. If not, it raises InstanceNotReady (which translates to a 409 in the OS API). Fix bug 1037809. Change-Id: I3f5af90d57ae84f98f787e14ccb66f1841ac0c6d --- nova/compute/api.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index e7f9368ea..ebf67729d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -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) -- cgit