summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-05-09 16:33:57 -0400
committerDan Prince <dprince@redhat.com>2012-05-09 16:37:37 -0400
commitd879dc9e0d28aa203426729c6cfea48bdbfa3cfd (patch)
tree94fc8caface082c65ec07afe0ad4835c3484399b
parent27873b4196a359e8d7101ff4da0785e4dd8787ab (diff)
Avoid unnecessary inst lookup in vmops _shutdown.
Updates the XenServer vmops.py _shutdown function so that it avoids calling get_info/_get_vm_opaque_ref with the instance name. Since _shutdown already has the vm_ref there is no need to make this call. This fixes an issue where 'RESIZE' was broken when resizing to the same host. Fixes LP Bug #997313. Change-Id: Ic5a1a0f92df9a2b809aef20a250843bf48402d75
-rw-r--r--nova/virt/xenapi/vmops.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 6cc0e2554..c60a32461 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -991,7 +991,8 @@ class VMOps(object):
def _shutdown(self, instance, vm_ref, hard=True):
"""Shutdown an instance."""
- state = self.get_info(instance)['state']
+ vm_rec = self._session.call_xenapi("VM.get_record", vm_ref)
+ state = VMHelper.compile_info(vm_rec)['state']
if state == power_state.SHUTDOWN:
LOG.warn(_("VM already halted, skipping shutdown..."),
instance=instance)