From e01123943e7fbe81d7cb40325cde6c517bb2ffd9 Mon Sep 17 00:00:00 2001 From: Ed Leafe Date: Fri, 7 Jan 2011 08:36:11 -0500 Subject: grabbed the get_info fix from my other branch --- nova/virt/xenapi/vmops.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 5f1654a49..65d0360c8 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -138,8 +138,9 @@ class VMOps(object): else: # Must be the instance name instance_name = instance_or_vm - except AttributeError: + except (AttributeError, KeyError): # Not a string; must be a vm instance + # Note the the KeyError will only happen with fakes.py instance_name = instance_or_vm.name vm = VMHelper.lookup(self._session, instance_name) if vm is None: @@ -297,9 +298,12 @@ class VMOps(object): task = self._session.call_xenapi('Async.VM.resume', vm, False, True) self._wait_with_callback(task, callback) - def get_info(self, instance): + def get_info(self, instance_id): """Return data about VM instance""" - vm = self._get_vm_opaque_ref(instance) + vm = VMHelper.lookup(self._session, instance_id) + if vm is None: + raise exception.NotFound(_('Instance not' + ' found %s') % instance_id) rec = self._session.get_xenapi().VM.get_record(vm) return VMHelper.compile_info(rec) -- cgit