From 0ca44e958461ee140b97d074fcf7866cc6ac6645 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 7 Jan 2013 13:19:03 -0500 Subject: Conductor instance_get_all replaces _by_filters Updates the Nova conductor so that it uses instance_get_all() and instance_get_all_by_host() from the Nova DB API to implement its own like named functions. This fixes a regression that occured in d22b0ca where we switched from using the DB API's instance_get_all_by_host and instance_get_all methods over to the DB APIs instance_get_all_by_filters. This caused some subtle regressions due to the fact that instance_get_all_by_filters has different defaults for deleted records. The previously used (prior to d22b0ca) instance_get_all() and instance_get_all_by_host() functions rely on the context.read_deleted and also handle the display of deleted and soft deleted records differently. Fixes LP Bug #1096972. Change-Id: Icb587ef169d1d7dd86cf6ee682e74bd4e84c37e2 --- nova/tests/conductor/test_conductor.py | 5 ++--- nova/tests/test_imagecache.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py index 86f47a79c..dcbafec9e 100644 --- a/nova/tests/conductor/test_conductor.py +++ b/nova/tests/conductor/test_conductor.py @@ -594,9 +594,8 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase): def test_instance_get_all(self): self.mox.StubOutWithMock(db, 'instance_get_all_by_filters') - db.instance_get_all_by_filters(self.context, {}, 'created_at', 'desc') - db.instance_get_all_by_filters(self.context, {'host': 'fake-host'}, - 'created_at', 'desc') + db.instance_get_all(self.context) + db.instance_get_all_by_host(self.context.elevated(), 'fake-host') db.instance_get_all_by_filters(self.context, {'name': 'fake-inst'}, 'updated_at', 'asc') self.mox.ReplayAll() diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py index affab4e29..f6c4f141f 100644 --- a/nova/tests/test_imagecache.py +++ b/nova/tests/test_imagecache.py @@ -947,7 +947,7 @@ class ImageCacheManagerTestCase(test.TestCase): with utils.tempdir() as tmpdir: self.flags(instances_path=tmpdir) - self.stubs.Set(db, 'instance_get_all_by_filters', fake_get_all) + self.stubs.Set(db, 'instance_get_all', fake_get_all) compute = importutils.import_object(CONF.compute_manager) self.flags(use_local=True, group='conductor') compute.conductor_api = conductor.API() -- cgit