summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-03-31 16:46:08 -0400
committerBrian Lamar <brian.lamar@rackspace.com>2011-03-31 16:46:08 -0400
commit7688cbb07ffcfd6446dc9ede60fb9eb610809c1d (patch)
treefb773a884e046bccc21c4b6b22b23c86b7514f2c /nova/virt
parent7803ee8c196f2890cd6e0bb383e79782b1248289 (diff)
Removal of instance_set_state from driver code, it shouldnt be there, but instead should be in the compute manager.
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/libvirt_conn.py4
-rw-r--r--nova/virt/xenapi/vmops.py26
2 files changed, 12 insertions, 18 deletions
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index f998a592b..bc9a031f9 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -597,8 +597,8 @@ class LibvirtConnection(driver.ComputeDriver):
try:
state = self.get_info(name)['state']
except (exception.NotFound, libvirt.libvirtError) as ex:
- msg = _("Error while waiting for VM to run: %s") % ex
- LOG.debug(msg)
+ msg = _("Error while waiting for VM '%(_id)s' to run: %(ex)s")
+ LOG.debug(msg % locals())
timer.stop()
if state == power_state.RUNNING:
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index c96c35a6e..fb3ca5306 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -206,33 +206,27 @@ class VMOps(object):
# NOTE(armando): Do we really need to do this in virt?
# NOTE(tr3buchet): not sure but wherever we do it, we need to call
# reset_network afterwards
- timer = utils.LoopingCall(f=None)
def _wait_for_boot():
try:
state = self.get_info(instance_name)['state']
- db.instance_set_state(context.get_admin_context(),
- instance['id'], state)
- if state == power_state.RUNNING:
- LOG.debug(_('Instance %s: booted'), instance_name)
- timer.stop()
- _inject_files()
- return True
- except Exception, exc:
- LOG.warn(exc)
- LOG.exception(_('instance %s: failed to boot'),
- instance_name)
- db.instance_set_state(context.get_admin_context(),
- instance['id'],
- power_state.SHUTDOWN)
+ except self.XenAPI.Failure as ex:
+ msg = _("Error while waiting for VM '%(instance_name)s' "
+ "to boot: %(ex)s") % locals()
+ LOG.debug(msg)
timer.stop()
return False
- timer.f = _wait_for_boot
+ if state == power_state.RUNNING:
+ LOG.debug(_('VM %s is now running.') % name)
+ timer.stop()
+ _inject_files()
+ return True
# call to reset network to configure network from xenstore
self.reset_network(instance, vm_ref)
+ timer = utils.LoopingCall(f=_wait_for_boot)
return timer.start(interval=0.5, now=True)
def _get_vm_opaque_ref(self, instance_or_vm):