summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2013-01-07 13:19:03 -0500
committerDan Prince <dprince@redhat.com>2013-01-07 16:05:58 -0500
commit0ca44e958461ee140b97d074fcf7866cc6ac6645 (patch)
treee0baf5c1bf3b623f1cbcd9c1a7e9539c79f6febd /nova/tests
parente1c7b18c7f3c8d97ba7b2cccf27b968ad4710735 (diff)
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
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/conductor/test_conductor.py5
-rw-r--r--nova/tests/test_imagecache.py2
2 files changed, 3 insertions, 4 deletions
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()