[pike-only] Fix resize_instance rpcapi call

After reservations parameter was removed from the call in compute
manager (change I9269ffa2b80e48db96c622d0dc0817738854f602), it began
passing clean_shutdown into reservations instead.
This is pike only change as this code was refactored in queens
(commit eae37a27ca) and reservations
parameter was removed.

Closes-Bug: 1793177
Change-Id: Ia59ec50bda18246b2747aefc6cc621ad54b698b0
This commit is contained in:
Vladyslav Drok 2018-09-18 19:32:16 +03:00 committed by Matt Riedemann
parent 4cddc8b904
commit 76f937b50a
3 changed files with 27 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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.