Fix Cells RPC API by accepting a RequestSpec arg
Since cells v1 adds a proxy to a call to ComputeTaskAPI for live_migrate and rebuild_instance, we need to augment the Cells RPC API to accept the request_spec argument for both methods. That said, since cells v1 is quite feature-freeze, it's okay to not pass the RequestSpec down to the pipe because the cell conductor will then act as if the instance was not having a Spec object, which is a compat behaviour we want to keep for a very long time. Closes-Bug: #1550018 Change-Id: I1c2aaedfc83e4e97f53c9c504e4585b1f0510d4b
This commit is contained in:
parent
bc1da0d229
commit
9ab6840af6
@ -571,7 +571,12 @@ class CellsAPI(object):
|
|||||||
cctxt.cast(ctxt, 'resize_instance', **msg_args)
|
cctxt.cast(ctxt, 'resize_instance', **msg_args)
|
||||||
|
|
||||||
def live_migrate_instance(self, ctxt, instance, host_name,
|
def live_migrate_instance(self, ctxt, instance, host_name,
|
||||||
block_migration, disk_over_commit):
|
block_migration, disk_over_commit,
|
||||||
|
request_spec=None):
|
||||||
|
# NOTE(sbauza): Since Cells v1 is quite feature-freeze, we don't want
|
||||||
|
# to pass down request_spec to the manager and rather keep the
|
||||||
|
# cell conductor providing a new RequestSpec like the original
|
||||||
|
# behaviour
|
||||||
cctxt = self.client.prepare(version='1.20')
|
cctxt = self.client.prepare(version='1.20')
|
||||||
cctxt.cast(ctxt, 'live_migrate_instance',
|
cctxt.cast(ctxt, 'live_migrate_instance',
|
||||||
instance=instance,
|
instance=instance,
|
||||||
@ -620,7 +625,12 @@ class CellsAPI(object):
|
|||||||
def rebuild_instance(self, ctxt, instance, new_pass, injected_files,
|
def rebuild_instance(self, ctxt, instance, new_pass, injected_files,
|
||||||
image_ref, orig_image_ref, orig_sys_metadata, bdms,
|
image_ref, orig_image_ref, orig_sys_metadata, bdms,
|
||||||
recreate=False, on_shared_storage=False, host=None,
|
recreate=False, on_shared_storage=False, host=None,
|
||||||
preserve_ephemeral=False, kwargs=None):
|
preserve_ephemeral=False, request_spec=None,
|
||||||
|
kwargs=None):
|
||||||
|
# NOTE(sbauza): Since Cells v1 is quite feature-freeze, we don't want
|
||||||
|
# to pass down request_spec to the manager and rather keep the
|
||||||
|
# cell conductor providing a new RequestSpec like the original
|
||||||
|
# behaviour
|
||||||
cctxt = self.client.prepare(version='1.25')
|
cctxt = self.client.prepare(version='1.25')
|
||||||
cctxt.cast(ctxt, 'rebuild_instance',
|
cctxt.cast(ctxt, 'rebuild_instance',
|
||||||
instance=instance, image_href=image_ref,
|
instance=instance, image_href=image_ref,
|
||||||
|
@ -682,6 +682,48 @@ class CellsAPITestCase(test.NoDBTestCase):
|
|||||||
self._check_result(call_info, 'live_migrate_instance',
|
self._check_result(call_info, 'live_migrate_instance',
|
||||||
expected_args, version='1.20')
|
expected_args, version='1.20')
|
||||||
|
|
||||||
|
def test_live_migrate_instance_not_passing_request_spec(self):
|
||||||
|
call_info = self._stub_rpc_method('cast', None)
|
||||||
|
|
||||||
|
self.cells_rpcapi.live_migrate_instance(self.fake_context,
|
||||||
|
'fake-instance',
|
||||||
|
'fake-host',
|
||||||
|
'fake-block',
|
||||||
|
'fake-commit',
|
||||||
|
'fake-spec')
|
||||||
|
expected_args = {'instance': 'fake-instance',
|
||||||
|
'block_migration': 'fake-block',
|
||||||
|
'disk_over_commit': 'fake-commit',
|
||||||
|
'host_name': 'fake-host'}
|
||||||
|
self._check_result(call_info, 'live_migrate_instance',
|
||||||
|
expected_args, version='1.20')
|
||||||
|
|
||||||
|
def test_rebuild_instance_not_passing_request_spec(self):
|
||||||
|
call_info = self._stub_rpc_method('cast', None)
|
||||||
|
|
||||||
|
self.cells_rpcapi.rebuild_instance(self.fake_context,
|
||||||
|
'fake-instance',
|
||||||
|
'fake-pass',
|
||||||
|
'fake-files',
|
||||||
|
'fake-image_ref',
|
||||||
|
'fake-orig_image_ref',
|
||||||
|
'fake-orig_sys_metadata',
|
||||||
|
'fake-bdms',
|
||||||
|
recreate=False,
|
||||||
|
on_shared_storage=False,
|
||||||
|
host=None,
|
||||||
|
preserve_ephemeral=False,
|
||||||
|
request_spec='fake-spec',
|
||||||
|
kwargs=None)
|
||||||
|
expected_args = {'instance': 'fake-instance',
|
||||||
|
'image_href': 'fake-image_ref',
|
||||||
|
'admin_password': 'fake-pass',
|
||||||
|
'files_to_inject': 'fake-files',
|
||||||
|
'preserve_ephemeral': False,
|
||||||
|
'kwargs': None}
|
||||||
|
self._check_result(call_info, 'rebuild_instance',
|
||||||
|
expected_args, version='1.25')
|
||||||
|
|
||||||
def test_revert_resize(self):
|
def test_revert_resize(self):
|
||||||
call_info = self._stub_rpc_method('cast', None)
|
call_info = self._stub_rpc_method('cast', None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user