diff options
| author | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-08 23:33:17 +0000 |
|---|---|---|
| committer | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-08 23:33:17 +0000 |
| commit | e7626da8ade4a3d29d441fed1c21c50cbc9928de (patch) | |
| tree | a17b08b4308713fba6f545327514560b5adc9840 | |
| parent | 15916435b538977bc05201f234952bb7dba5b7b2 (diff) | |
using get_uuid in place of get_record in _get_vm_opaqueref
changed SessionBase._getter in fake xenapi in order to return HANDLE_INVALID failure when reference is not in DB
(was NotImplementedException)
| -rw-r--r-- | nova/virt/xenapi/fake.py | 11 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 09e381e2c..eecfa20b1 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -400,7 +400,6 @@ class SessionBase(object): def _getter(self, name, params): self._check_session(params) (cls, func) = name.split('.') - if func == 'get_all': self._check_arg_count(params, 1) return get_all(cls) @@ -423,10 +422,12 @@ class SessionBase(object): if len(params) == 2: field = func[len('get_'):] ref = params[1] - - if (ref in _db_content[cls] and - field in _db_content[cls][ref]): - return _db_content[cls][ref][field] + if (ref in _db_content[cls]): + if (field in _db_content[cls][ref]): + return _db_content[cls][ref][field] + else: + LOG.debug(_('Raising Failure')) + raise Failure(['HANDLE_INVALID', cls, ref]) LOG.debug(_('Raising NotImplemented')) raise NotImplementedError( diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index ddd5b0e16..273a7ba38 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -198,7 +198,7 @@ class VMOps(object): obj = None try: # check for opaque ref - obj = self._session.get_xenapi().VM.get_record(instance_or_vm) + obj = self._session.get_xenapi().VM.get_uuid(instance_or_vm) return instance_or_vm except self.XenAPI.Failure: # wasn't an opaque ref, can be an instance name |
