From 5555446d877223341c2723e4be169d996ab2ce3b Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 8 Mar 2012 19:13:26 +0000 Subject: Wait for rescue VM shutdown to complete before destroying it Fixes bug 950168 Also, wait for the VM and VDI destroys to complete so any errors can get logged Change-Id: I2c2237ed6f95828198824db8628d267ac5b26b3a --- nova/virt/xenapi/vmops.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index fe912c43d..9de6242bf 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1091,7 +1091,7 @@ class VMOps(object): def _shutdown_rescue(self, rescue_vm_ref): """Shutdown a rescue instance.""" - self._session.call_xenapi("Async.VM.hard_shutdown", rescue_vm_ref) + self._session.call_xenapi("VM.hard_shutdown", rescue_vm_ref) def _destroy_vdis(self, instance, vm_ref): """Destroys all VDIs associated with a VM.""" @@ -1115,9 +1115,9 @@ class VMOps(object): vdi_refs = VMHelper.lookup_vm_vdis(self._session, rescue_vm_ref) for vdi_ref in vdi_refs: try: - self._session.call_xenapi("Async.VDI.destroy", vdi_ref) - except self.XenAPI.Failure: - continue + VMHelper.destroy_vdi(self._session, vdi_ref) + except volume_utils.StorageError as exc: + LOG.error(exc) def _destroy_rescue_vbds(self, rescue_vm_ref): """Destroys all VBDs tied to a rescue VM.""" @@ -1187,7 +1187,7 @@ class VMOps(object): self._shutdown_rescue(rescue_vm_ref) self._destroy_rescue_vdis(rescue_vm_ref) - self._session.call_xenapi("Async.VM.destroy", rescue_vm_ref) + self._session.call_xenapi("VM.destroy", rescue_vm_ref) def destroy(self, instance, network_info): """Destroy VM instance. -- cgit