diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-03-07 16:11:10 -0600 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2011-03-07 16:11:10 -0600 |
| commit | 59f73e3180731cec644b590d448e0da74711ae03 (patch) | |
| tree | fba19755ee83377316060a5e99161fdba3038e0e /nova | |
| parent | f79220a1f6a12621463b410d26e31e29a9e6ea3e (diff) | |
| download | nova-59f73e3180731cec644b590d448e0da74711ae03.tar.gz nova-59f73e3180731cec644b590d448e0da74711ae03.tar.xz nova-59f73e3180731cec644b590d448e0da74711ae03.zip | |
virt.xenapi.vmops._get_vm_opaque_ref exception caught properly
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index b1671fde4..ae4609418 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -190,13 +190,16 @@ class VMOps(object): """ # if instance_or_vm is a string it must be opaque ref or instance name if isinstance(instance_or_vm, str): - vm_rec = self._session.get_xenapi().VM.get_record(instance_or_vm) - if vm_rec != None: - # an opaque ref was passed in, return it - return instance_or_vm - else: - # it must be an instance name - instance_name = instance_or_vm + ref = None + try: + ref = self._session.get_xenapi().VM.get_record(instance_or_vm) + if ref != None: + # an opaque ref was passed in, return it + return instance_or_vm + except: + pass + # wasn't an opaque ref, must be an instance name + instance_name = instance_or_vm # if instance_or_vm is an int/long it must be instance id elif isinstance(instance_or_vm, (int, long)): |
