summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-10 12:55:27 -0800
committerDan Smith <danms@us.ibm.com>2012-12-10 16:14:23 -0800
commit3f6a2d1621ce4bdca4fb95d561e1dd703c0737bd (patch)
tree422382376db216e875e6543705fc1a2028380aab /nova/tests
parent07848e761a13afaf44c58d99ceb6a133e6999470 (diff)
Make nova/virt use aggregate['metadetails']
This patch makes nova/virt use the metadata attached to the aggregate object instead of querying it separately. This allows us to remove a method from VirtAPI and avoid adding another one to conductor to support it. Change-Id: I4b9ff59147d30ff6f71fa66e838f060b8853dc95
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_xenapi.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index f570e9959..b226b34df 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -2399,23 +2399,31 @@ class ResourcePoolWithStubs(StubDependencies, pool.ResourcePool):
class HypervisorPoolTestCase(test.TestCase):
+ fake_aggregate = {
+ 'id': 98,
+ 'hosts': [],
+ 'metadetails': {
+ 'master_compute': 'master',
+ pool_states.POOL_FLAG: {},
+ pool_states.KEY: {}
+ }
+ }
+
def test_slave_asks_master_to_add_slave_to_pool(self):
slave = ResourcePoolWithStubs()
- aggregate = {'id': 98, 'hosts': []}
- slave.add_to_aggregate("CONTEXT", aggregate, "slave")
+ slave.add_to_aggregate("CONTEXT", self.fake_aggregate, "slave")
self.assertIn(
(slave.compute_rpcapi.add_aggregate_host,
- "CONTEXT", jsonutils.to_primitive(aggregate),
+ "CONTEXT", jsonutils.to_primitive(self.fake_aggregate),
"slave", "master", "SLAVE_INFO"),
slave.compute_rpcapi._mock_calls)
def test_slave_asks_master_to_remove_slave_from_pool(self):
slave = ResourcePoolWithStubs()
- aggregate = {'id': 98, 'hosts': []}
- slave.remove_from_aggregate("CONTEXT", aggregate, "slave")
+ slave.remove_from_aggregate("CONTEXT", self.fake_aggregate, "slave")
self.assertIn(
(slave.compute_rpcapi.remove_aggregate_host,