diff options
author | Stephen Finucane <sfinucan@redhat.com> | 2019-05-22 17:19:29 +0100 |
---|---|---|
committer | Stephen Finucane <sfinucan@redhat.com> | 2019-06-12 16:09:46 +0100 |
commit | 8d5359ca517be84a5fd551fea8246fd5c2ccebeb (patch) | |
tree | 74e4995ba337358004b42c4e3ad41281f52f8980 | |
parent | f298973520420710a617e4d79e853f2416b29786 (diff) | |
download | nova-8d5359ca517be84a5fd551fea8246fd5c2ccebeb.tar.gz |
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>
-rw-r--r-- | nova/compute/api.py | 11 | ||||
-rw-r--r-- | nova/compute/manager.py | 2 | ||||
-rw-r--r-- | nova/conductor/api.py | 12 | ||||
-rw-r--r-- | nova/tests/functional/regressions/test_bug_1830747.py | 9 | ||||
-rw-r--r-- | nova/tests/unit/compute/test_compute.py | 11 | ||||
-rw-r--r-- | nova/tests/unit/compute/test_compute_api.py | 21 | ||||
-rw-r--r-- | nova/tests/unit/conductor/test_conductor.py | 2 |
7 files changed, 27 insertions, 41 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index ab1dc852a5..983d55f866 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -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, diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 914131d4a3..a0d9b5a503 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -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 diff --git a/nova/conductor/api.py b/nova/conductor/api.py index ccf6b10279..048549b70f 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -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, diff --git a/nova/tests/functional/regressions/test_bug_1830747.py b/nova/tests/functional/regressions/test_bug_1830747.py index c93e679772..5820540d5b 100644 --- a/nova/tests/functional/regressions/test_bug_1830747.py +++ b/nova/tests/functional/regressions/test_bug_1830747.py @@ -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) diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index 364b333150..5ef91d3f3a 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -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( diff --git a/nova/tests/unit/compute/test_compute_api.py b/nova/tests/unit/compute/test_compute_api.py index 0cacceba58..73fc22396d 100644 --- a/nova/tests/unit/compute/test_compute_api.py +++ b/nova/tests/unit/compute/test_compute_api.py @@ -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) diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index 68a6bfa61e..6a4473a047 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -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( |