diff options
| author | Ed Leafe <ed@leafe.com> | 2011-01-07 08:36:11 -0500 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-01-07 08:36:11 -0500 |
| commit | e01123943e7fbe81d7cb40325cde6c517bb2ffd9 (patch) | |
| tree | 0b966925f198063601caec6f2d51d86311656d44 /nova | |
| parent | dea9f51d65ce0d5c3c4ea328a2231499c71719d6 (diff) | |
| download | nova-e01123943e7fbe81d7cb40325cde6c517bb2ffd9.tar.gz nova-e01123943e7fbe81d7cb40325cde6c517bb2ffd9.tar.xz nova-e01123943e7fbe81d7cb40325cde6c517bb2ffd9.zip | |
grabbed the get_info fix from my other branch
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 10 |
1 files 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) |
