Permalink
Browse files

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
  • Loading branch information...
1 parent a5fba51 commit 5555446d877223341c2723e4be169d996ab2ce3b @jerdfelt jerdfelt committed Mar 8, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 nova/virt/xenapi/vmops.py
View
10 nova/virt/xenapi/vmops.py
@@ -1091,7 +1091,7 @@ def _find_rescue_vbd_ref(self, vm_ref, rescue_vm_ref):
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 @@ def _destroy_rescue_vdis(self, rescue_vm_ref):
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 @@ def _destroy_rescue_instance(self, rescue_vm_ref):
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.

0 comments on commit 5555446

Please sign in to comment.