Remove cells v1 parameter from 'ComputeTaskAPI.resize_instance'

The 'extra_instance_updates' parameter was only used by cells v1 and can
therefore be removed.

Part of blueprint remove-cells-v1

Change-Id: I70012f7be863afc9d9ed8882cc5d9d193bbb7b6d
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2019-05-22 17:19:29 +01:00
parent f298973520
commit 8d5359ca51
7 changed files with 27 additions and 41 deletions

View File

@ -3459,6 +3459,9 @@ class API(base.Base):
migration,
migration.source_compute)
# TODO(mriedem): It looks like for resize (not cold migrate) the only
# possible kwarg here is auto_disk_config. Drop this dumb **kwargs and make
# it explicitly an auto_disk_config param
@check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED])
def resize(self, context, instance, flavor_id=None, clean_shutdown=True,
@ -3588,10 +3591,10 @@ class API(base.Base):
host=node.host, node=node.hypervisor_hostname)
self.compute_task_api.resize_instance(context, instance,
extra_instance_updates, scheduler_hint=scheduler_hint,
flavor=new_instance_type,
clean_shutdown=clean_shutdown,
request_spec=request_spec)
scheduler_hint=scheduler_hint,
flavor=new_instance_type,
clean_shutdown=clean_shutdown,
request_spec=request_spec)
@check_instance_lock
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,

View File

@ -4449,7 +4449,7 @@ class ComputeManager(manager.Manager):
scheduler_hint = {'filter_properties': filter_properties}
self.compute_task_api.resize_instance(
context, instance, None, scheduler_hint, instance_type,
context, instance, scheduler_hint, instance_type,
request_spec=request_spec, host_list=host_list)
rescheduled = True

View File

@ -84,13 +84,11 @@ class ComputeTaskAPI(object):
def __init__(self):
self.conductor_compute_rpcapi = rpcapi.ComputeTaskAPI()
def resize_instance(self, context, instance, extra_instance_updates,
scheduler_hint, flavor, reservations=None,
clean_shutdown=True, request_spec=None,
host_list=None):
# NOTE(comstud): 'extra_instance_updates' is not used here but is
# needed for compatibility with the cells_rpcapi version of this
# method.
# TODO(stephenfin): Remove the 'reservations' parameter since we don't use
# reservations anymore
def resize_instance(self, context, instance, scheduler_hint, flavor,
reservations=None, clean_shutdown=True,
request_spec=None, host_list=None):
self.conductor_compute_rpcapi.migrate_server(
context, instance, scheduler_hint, live=False, rebuild=False,
flavor=flavor, block_migration=None, disk_over_commit=None,

View File

@ -117,9 +117,8 @@ class MissingReqSpecInstanceGroupUUIDTestCase(
# This simulates the pre-Stein reschedule behavior.
original_resize_instance = conductor_api.ComputeTaskAPI.resize_instance
def stub_resize_instance(_self, context, instance,
extra_instance_updates, scheduler_hint,
*args, **kwargs):
def stub_resize_instance(_self, context, instance, scheduler_hint,
flavor, *args, **kwargs):
# Only remove the request spec if we know we're rescheduling
# which we can determine from the filter_properties retry dict.
filter_properties = scheduler_hint['filter_properties']
@ -129,8 +128,8 @@ class MissingReqSpecInstanceGroupUUIDTestCase(
self.assertEqual(group_id, filter_properties['group_uuid'])
kwargs.pop('request_spec', None)
return original_resize_instance(
_self, context, instance, extra_instance_updates,
scheduler_hint, *args, **kwargs)
_self, context, instance, scheduler_hint, flavor, *args,
**kwargs)
self.stub_out('nova.conductor.api.ComputeTaskAPI.resize_instance',
stub_resize_instance)

View File

@ -144,10 +144,9 @@ def unify_instance(instance):
class FakeComputeTaskAPI(object):
def resize_instance(self, ctxt, instance, extra_instance_updates,
scheduler_hint, flavor, reservations=None,
clean_shutdown=True, request_spec=None,
host_list=None):
def resize_instance(self, ctxt, instance, scheduler_hint, flavor,
reservations=None, clean_shutdown=True,
request_spec=None, host_list=None):
pass
@ -12886,7 +12885,7 @@ class ComputeRescheduleResizeOrReraiseTestCase(BaseTestCase):
mock_update.assert_called_once_with(
self.context, mock.ANY, task_state=task_states.RESIZE_PREP)
mock_resize.assert_called_once_with(
self.context, mock.ANY, None,
self.context, mock.ANY,
{'filter_properties': filter_properties}, self.instance_type,
request_spec=self.request_spec, host_list=None)
mock_notify.assert_called_once_with(
@ -12916,7 +12915,7 @@ class ComputeRescheduleResizeOrReraiseTestCase(BaseTestCase):
mock_update.assert_called_once_with(
self.context, mock.ANY, task_state=task_states.RESIZE_PREP)
mock_resize.assert_called_once_with(
self.context, mock.ANY, None,
self.context, mock.ANY,
{'filter_properties': filter_properties}, self.instance_type,
request_spec=self.request_spec, host_list=None)
mock_notify.assert_called_once_with(

View File

@ -1891,14 +1891,11 @@ class _ComputeAPIUnitTestMixIn(object):
flavor_id_passed=True,
same_host=False, allow_same_host=False,
project_id=None,
extra_kwargs=None,
same_flavor=False,
clean_shutdown=True,
host_name=None,
request_spec=True,
requested_destination=False):
if extra_kwargs is None:
extra_kwargs = {}
self.flags(allow_resize_to_same_host=allow_same_host)
@ -1942,8 +1939,6 @@ class _ComputeAPIUnitTestMixIn(object):
self.assertEqual(task_states.RESIZE_PREP,
fake_inst.task_state)
self.assertEqual(fake_inst.progress, 0)
for key, value in extra_kwargs.items():
self.assertEqual(value, getattr(fake_inst, key))
mock_inst_save.side_effect = _check_state
@ -1970,20 +1965,18 @@ class _ComputeAPIUnitTestMixIn(object):
self.compute_api.resize(self.context, fake_inst,
flavor_id='new-flavor-id',
clean_shutdown=clean_shutdown,
host_name=host_name,
**extra_kwargs)
host_name=host_name)
else:
if request_spec:
self.compute_api.resize(self.context, fake_inst,
clean_shutdown=clean_shutdown,
host_name=host_name,
**extra_kwargs)
host_name=host_name)
else:
self.assertRaises(exception.RequestSpecNotFound,
self.compute_api.resize,
self.context, fake_inst,
clean_shutdown=clean_shutdown,
host_name=host_name, **extra_kwargs)
host_name=host_name)
if request_spec:
if allow_same_host:
@ -2055,7 +2048,7 @@ class _ComputeAPIUnitTestMixIn(object):
if request_spec:
mock_resize.assert_called_once_with(
self.context, fake_inst, extra_kwargs,
self.context, fake_inst,
scheduler_hint=scheduler_hint,
flavor=test.MatchType(objects.Flavor),
clean_shutdown=clean_shutdown,
@ -2069,9 +2062,6 @@ class _ComputeAPIUnitTestMixIn(object):
def test_resize(self):
self._test_resize()
def test_resize_with_kwargs(self):
self._test_resize(extra_kwargs=dict(cow='moo'))
def test_resize_same_host_and_allowed(self):
self._test_resize(same_host=True, allow_same_host=True)
@ -2118,9 +2108,6 @@ class _ComputeAPIUnitTestMixIn(object):
def test_migrate(self):
self._test_migrate()
def test_migrate_with_kwargs(self):
self._test_migrate(extra_kwargs=dict(cow='moo'))
def test_migrate_same_host_and_allowed(self):
self._test_migrate(same_host=True, allow_same_host=True)

View File

@ -401,7 +401,7 @@ class _BaseTaskTestCase(object):
# The API method is actually 'resize_instance'. It gets
# converted into 'migrate_server' when doing RPC.
self.conductor.resize_instance(
self.context, inst_obj, {}, scheduler_hint, flavor, [],
self.context, inst_obj, scheduler_hint, flavor, [],
clean_shutdown, host_list=None)
else:
self.conductor.migrate_server(