Make os.services.update work with cells

In the nova.api.openstack.compute.contrib.services:

 * Make update (enable/disable) service work

In nova.compute.api.api.HostAPI:

 Add - service_update - Used by openstack api's services.py

In nova.compute.api.cells_api.HostAPI:

 Add - service_update - Used by openstack api's services.py

In cells:

 * Increase API version from 1.6 to 1.7
 * Add service_update

Fixes bug #1150499

Change-Id: I5651bd5bc328692df82f4d9da27d390a8c95e03f
This commit is contained in:
Matthew Sherborne
2013-03-15 13:46:12 +10:00
parent bfc3a3ccb2
commit 732bcdb950
10 changed files with 210 additions and 11 deletions

View File

@@ -294,6 +294,26 @@ class CellsManagerClassTestCase(test.TestCase):
host_name=cell_and_host)
self.assertEqual(expected_response, response)
def test_service_update(self):
fake_cell = 'fake-cell'
fake_response = messaging.Response(
fake_cell, FAKE_SERVICES[0], False)
expected_response = copy.deepcopy(FAKE_SERVICES[0])
cells_utils.add_cell_to_service(expected_response, fake_cell)
cell_and_host = cells_utils.cell_with_item('fake-cell', 'fake-host')
params_to_update = {'disabled': True}
self.mox.StubOutWithMock(self.msg_runner, 'service_update')
self.msg_runner.service_update(self.ctxt,
fake_cell, 'fake-host', 'nova-api',
params_to_update).AndReturn(fake_response)
self.mox.ReplayAll()
response = self.cells_manager.service_update(
self.ctxt, host_name=cell_and_host, binary='nova-api',
params_to_update=params_to_update)
self.assertEqual(expected_response, response)
def test_proxy_rpc_to_manager(self):
self.mox.StubOutWithMock(self.msg_runner,
'proxy_rpc_to_manager')