Send all aggregate data to add_aggregate_host.
Update the add_aggregate_host method of the compute rpc api to take in all aggregate data instead of just the aggregate id. This avoids a db lookup in the nova-compute service. Part of blueprint no-db-compute. Change-Id: Iaccfa28ac23452a4e78581c6b5a6687417283838
This commit is contained in:
@@ -2241,7 +2241,8 @@ class XenAPIAggregateTestCase(stubs.XenAPITestBase):
|
||||
|
||||
self.assertRaises(exception.AggregateError,
|
||||
self.compute.add_aggregate_host,
|
||||
self.context, self.aggr.id, "fake_host")
|
||||
self.context, "fake_host",
|
||||
aggregate=jsonutils.to_primitive(self.aggr))
|
||||
excepted = db.aggregate_get(self.context, self.aggr.id)
|
||||
self.assertEqual(excepted.metadetails[pool_states.KEY],
|
||||
pool_states.ERROR)
|
||||
@@ -2258,10 +2259,10 @@ class MockComputeAPI(object):
|
||||
def __init__(self):
|
||||
self._mock_calls = []
|
||||
|
||||
def add_aggregate_host(self, ctxt, aggregate_id,
|
||||
def add_aggregate_host(self, ctxt, aggregate,
|
||||
host_param, host, slave_info):
|
||||
self._mock_calls.append((
|
||||
self.add_aggregate_host, ctxt, aggregate_id,
|
||||
self.add_aggregate_host, ctxt, aggregate,
|
||||
host_param, host, slave_info))
|
||||
|
||||
def remove_aggregate_host(self, ctxt, aggregate_id, host_param,
|
||||
@@ -2304,7 +2305,8 @@ class HypervisorPoolTestCase(test.TestCase):
|
||||
|
||||
self.assertIn(
|
||||
(slave.compute_rpcapi.add_aggregate_host,
|
||||
"CONTEXT", 98, "slave", "master", "SLAVE_INFO"),
|
||||
"CONTEXT", jsonutils.to_primitive(aggregate),
|
||||
"slave", "master", "SLAVE_INFO"),
|
||||
slave.compute_rpcapi._mock_calls)
|
||||
|
||||
def test_slave_asks_master_to_remove_slave_from_pool(self):
|
||||
|
||||
Reference in New Issue
Block a user