From 4944a612e0926cfe542e0cb146cc9fabf70256f6 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Wed, 21 Mar 2012 18:59:57 +0000 Subject: Only shutdown rescue instance if it's not already shutdown Fixes bug 961507 Change-Id: Ib48d6ea3ad7c89e922cde8e0c0952d1bee2ca7bf --- nova/virt/xenapi/vmops.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 52d935fa4..3e2f3527b 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1079,7 +1079,10 @@ class VMOps(object): def _shutdown_rescue(self, rescue_vm_ref): """Shutdown a rescue instance.""" - self._session.call_xenapi("VM.hard_shutdown", rescue_vm_ref) + vm_rec = self._session.call_xenapi("VM.get_record", rescue_vm_ref) + state = VMHelper.compile_info(vm_rec)['state'] + if state != power_state.SHUTDOWN: + self._session.call_xenapi("VM.hard_shutdown", rescue_vm_ref) def _destroy_vdis(self, instance, vm_ref): """Destroys all VDIs associated with a VM.""" -- cgit