diff options
| author | Dan Smith <danms@us.ibm.com> | 2013-05-30 09:33:01 -0700 |
|---|---|---|
| committer | Dan Smith <danms@us.ibm.com> | 2013-06-07 11:43:37 -0700 |
| commit | 168ff33d104c76606079748ea09cb97ff8fc97fe (patch) | |
| tree | 8ce7e112ff861ca4cd048db950f41f57ee4e4d19 /nova/tests | |
| parent | eefc3c1892c523100470414d00a981ea9fbdf3ca (diff) | |
| download | nova-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/tests')
| -rw-r--r-- | nova/tests/virt/xenapi/test_xenapi.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nova/tests/virt/xenapi/test_xenapi.py b/nova/tests/virt/xenapi/test_xenapi.py index bc166655d..cb81583e5 100644 --- a/nova/tests/virt/xenapi/test_xenapi.py +++ b/nova/tests/virt/xenapi/test_xenapi.py @@ -38,6 +38,7 @@ from nova.openstack.common import jsonutils from nova.openstack.common import log as logging from nova import test from nova.tests.db import fakes as db_fakes +from nova.tests import fake_instance from nova.tests import fake_network from nova.tests import fake_processutils import nova.tests.image.fake as fake_image @@ -1173,6 +1174,19 @@ class XenAPIVMTestCase(stubs.XenAPITestBase): self.assertRaises(exception.NotFound, self._test_maintenance_mode, True, False) + def test_uuid_find(self): + self.mox.StubOutWithMock(db, 'instance_get_all_by_host') + fake_inst = fake_instance.fake_db_instance(id=123) + fake_inst2 = fake_instance.fake_db_instance(id=456) + db.instance_get_all_by_host(self.context, fake_inst['host'], + columns_to_join=None + ).AndReturn([fake_inst, fake_inst2]) + self.mox.ReplayAll() + expected_name = CONF.instance_name_template % fake_inst['id'] + inst_uuid = host._uuid_find(self.context, fake_inst['host'], + expected_name) + self.assertEqual(inst_uuid, fake_inst['uuid']) + def test_session_virtapi(self): was = {'called': False} |
