summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2012-06-26 01:59:29 +0000
committerChris Behrens <cbehrens@codestud.com>2012-06-26 02:31:41 +0000
commit3fd86122ca7085dd6112d50ea831eaf36e40e882 (patch)
tree04a54c6c862744ff1cac3f581b569a3dffe56165 /nova/tests
parentca1f1d39b8ee85f55d5b656f7db946f855be5cb2 (diff)
Improve filter_scheduler performance
Add 'columns_to_join' keyword arg to instance_get_all() and have the scheduler host_manager only join 'instance_type'. It doesn't use anything else. Fixes bug 1017769 Change-Id: Ia2c0956d2453f00e26eb89d9496a32ba15d970aa
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/scheduler/fakes.py3
-rw-r--r--nova/tests/scheduler/test_host_manager.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/nova/tests/scheduler/fakes.py b/nova/tests/scheduler/fakes.py
index 83fbfe8b7..29d4807ac 100644
--- a/nova/tests/scheduler/fakes.py
+++ b/nova/tests/scheduler/fakes.py
@@ -139,4 +139,5 @@ def mox_host_manager_db_calls(mock, context):
mock.StubOutWithMock(db, 'instance_get_all')
db.compute_node_get_all(mox.IgnoreArg()).AndReturn(COMPUTE_NODES)
- db.instance_get_all(mox.IgnoreArg()).AndReturn(INSTANCES)
+ db.instance_get_all(mox.IgnoreArg(),
+ columns_to_join=['instance_type']).AndReturn(INSTANCES)
diff --git a/nova/tests/scheduler/test_host_manager.py b/nova/tests/scheduler/test_host_manager.py
index 987bffea1..d28e51c00 100644
--- a/nova/tests/scheduler/test_host_manager.py
+++ b/nova/tests/scheduler/test_host_manager.py
@@ -250,7 +250,9 @@ class HostManagerTestCase(test.TestCase):
db.compute_node_get_all(context).AndReturn(fakes.COMPUTE_NODES)
# Invalid service
host_manager.LOG.warn("No service for compute ID 5")
- db.instance_get_all(context).AndReturn(fakes.INSTANCES)
+ db.instance_get_all(context,
+ columns_to_join=['instance_type']).AndReturn(
+ fakes.INSTANCES)
self.mox.ReplayAll()
host_states = self.host_manager.get_all_host_states(context, topic)