summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-05-30 09:33:01 -0700
committerDan Smith <danms@us.ibm.com>2013-06-07 11:43:37 -0700
commit168ff33d104c76606079748ea09cb97ff8fc97fe (patch)
tree8ce7e112ff861ca4cd048db950f41f57ee4e4d19 /nova/virt
parenteefc3c1892c523100470414d00a981ea9fbdf3ca (diff)
downloadnova-168ff33d104c76606079748ea09cb97ff8fc97fe.tar.gz
nova-168ff33d104c76606079748ea09cb97ff8fc97fe.tar.xz
nova-168ff33d104c76606079748ea09cb97ff8fc97fe.zip
Make xenapi/host use instance objects for _uuid_find
This is the one and only use of instance_get_all_by_host() in the nova/virt tree. Converting it to objects immediately eliminates the need for that method in the virtapi. Related to blueprint unified-object-model Change-Id: I21dfd5a34fb1eef4d442c0711f37e5ef6b18e5bb
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/xenapi/host.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/nova/virt/xenapi/host.py b/nova/virt/xenapi/host.py
index 258e4d145..5fa2b55db 100644
--- a/nova/virt/xenapi/host.py
+++ b/nova/virt/xenapi/host.py
@@ -23,6 +23,7 @@ from nova.compute import task_states
from nova.compute import vm_states
from nova import context
from nova import exception
+from nova.objects import instance as instance_obj
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova.virt.xenapi import pool_states
@@ -63,7 +64,7 @@ class Host(object):
uuid = vm_rec['other_config'].get('nova_uuid')
if not uuid:
name = vm_rec['name_label']
- uuid = _uuid_find(self._virtapi, ctxt, host, name)
+ uuid = _uuid_find(ctxt, host, name)
if not uuid:
msg = _('Instance %(name)s running on %(host)s'
' could not be found in the database:'
@@ -207,11 +208,11 @@ def call_xenhost(session, method, arg_dict):
return e.details[1]
-def _uuid_find(virtapi, context, host, name_label):
+def _uuid_find(context, host, name_label):
"""Return instance uuid by name_label."""
- for i in virtapi.instance_get_all_by_host(context, host):
+ for i in instance_obj.InstanceList.get_by_host(context, host):
if i.name == name_label:
- return i['uuid']
+ return i.uuid
return None