diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 573ba1724c2d..c82bd9128294 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3811,7 +3811,7 @@ class ComputeManager(manager.Manager): LOG.info('Migrating', instance=instance) self.compute_rpcapi.resize_instance( context, instance, claim.migration, image, - instance_type, clean_shutdown) + instance_type, clean_shutdown=clean_shutdown) @wrap_exception() @reverts_task_state diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index e67476123cb1..517256a1775a 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -4611,6 +4611,26 @@ class ComputeTestCase(BaseTestCase, self.compute.terminate_instance(self.context, instance, bdms=[], reservations=[]) + @mock.patch.object(fake_resource_tracker.FakeResourceTracker, + 'disabled', return_value=True) + def test_prep_resize_rpcapi_call(self, mock_disabled): + """Ensures the order of parameters of resize_instance rpcapi call.""" + inst_obj = self._create_fake_instance_obj() + instance_type = flavors.get_default_flavor() + + with mock.patch.object( + self.compute.compute_rpcapi, 'resize_instance') as mock_resize: + self.compute.prep_resize(self.context, image=None, + instance=inst_obj, + instance_type=instance_type, + reservations=[], request_spec={}, + filter_properties={}, node=None, + clean_shutdown=True) + + mock_resize.assert_called_once_with( + self.context, inst_obj, mock.ANY, None, instance_type, + clean_shutdown=True) + def _stub_out_resize_network_methods(self): def fake(cls, ctxt, instance, *args, **kwargs): pass diff --git a/releasenotes/notes/fix-resize-instance-call-e987193c574c6486.yaml b/releasenotes/notes/fix-resize-instance-call-e987193c574c6486.yaml new file mode 100644 index 000000000000..41c8852bd542 --- /dev/null +++ b/releasenotes/notes/fix-resize-instance-call-e987193c574c6486.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue with cold migrating (resizing) an instance from + ocata to pike compute by correcting parameters order in + resize_instance rpcapi call to destination compute.