diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-06-20 00:44:25 +0000 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2012-06-20 22:33:15 +0000 |
| commit | 23ec8c915c900fcafd1683da000817ef4497bf93 (patch) | |
| tree | 03e10134e34227b01b052284d7a9c7e46d8c4c2a /nova/virt | |
| parent | cf1854946838bf14607d05acd6f347702372b744 (diff) | |
Make libvirt LoopingCalls actually wait()
* Adds wait() to all the LoopingCall timers
* Fixes loopingCalls in baremetal/proxy.py as well
* Includes failing test to verify result from destroy
* Fixes tests depending on improper behavior
* Fixes bug 1015355
Change-Id: I9e1914c446170e49f0aab76c7745b55d12132425
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/baremetal/proxy.py | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/nova/virt/baremetal/proxy.py b/nova/virt/baremetal/proxy.py index 1c5729422..f1aa908bb 100644 --- a/nova/virt/baremetal/proxy.py +++ b/nova/virt/baremetal/proxy.py @@ -174,7 +174,7 @@ class ProxyConnection(driver.ComputeDriver): LOG.exception(_('_wait_for_reboot failed'), instance=instance) timer.stop() timer.f = _wait_for_reboot - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() @exception.wrap_exception def rescue(self, context, instance, network_info): @@ -207,7 +207,7 @@ class ProxyConnection(driver.ComputeDriver): LOG.exception(_('_wait_for_rescue failed'), instance=instance) timer.stop() timer.f = _wait_for_rescue - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() @exception.wrap_exception def unrescue(self, instance, network_info): @@ -275,7 +275,7 @@ class ProxyConnection(driver.ComputeDriver): timer.stop() timer.f = _wait_for_boot - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() def get_console_output(self, instance): console_log = os.path.join(FLAGS.instances_path, instance['name'], diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 6f0f1f630..59a32ee5b 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -464,7 +464,7 @@ class LibvirtDriver(driver.ComputeDriver): raise utils.LoopingCallDone(True) timer = utils.LoopingCall(_wait_for_destroy) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() def destroy(self, instance, network_info, block_device_info=None): self._destroy(instance) @@ -823,7 +823,7 @@ class LibvirtDriver(driver.ComputeDriver): instance=instance) self._create_domain(domain=dom) timer = utils.LoopingCall(self._wait_for_running, instance) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() greenthread.sleep(1) return False @@ -854,7 +854,7 @@ class LibvirtDriver(driver.ComputeDriver): raise utils.LoopingCallDone timer = utils.LoopingCall(_wait_for_reboot) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() @exception.wrap_exception() def pause(self, instance): @@ -879,7 +879,7 @@ class LibvirtDriver(driver.ComputeDriver): dom = self._lookup_by_name(instance['name']) self._create_domain(domain=dom) timer = utils.LoopingCall(self._wait_for_running, instance) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() @exception.wrap_exception() def suspend(self, instance): @@ -991,7 +991,7 @@ class LibvirtDriver(driver.ComputeDriver): raise utils.LoopingCallDone timer = utils.LoopingCall(_wait_for_boot) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() def _flush_libvirt_console(self, pty): out, err = utils.execute('dd', @@ -2250,7 +2250,7 @@ class LibvirtDriver(driver.ComputeDriver): post_method(ctxt, instance_ref, dest, block_migration) timer.f = wait_for_live_migration - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() def pre_live_migration(self, block_device_info): """Preparation live migration. @@ -2591,7 +2591,7 @@ class LibvirtDriver(driver.ComputeDriver): block_device_info=None) self._create_domain_and_network(xml, instance, network_info) timer = utils.LoopingCall(self._wait_for_running, instance) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() @exception.wrap_exception() def finish_revert_migration(self, instance, network_info): @@ -2607,7 +2607,7 @@ class LibvirtDriver(driver.ComputeDriver): self._create_domain_and_network(xml, instance, network_info) timer = utils.LoopingCall(self._wait_for_running, instance) - return timer.start(interval=0.5) + return timer.start(interval=0.5).wait() def confirm_migration(self, migration, instance, network_info): """Confirms a resize, destroying the source VM""" |
