diff --git a/nova/cells/messaging.py b/nova/cells/messaging.py index 8734b7aa7b96..c8e5fdfd5d80 100644 --- a/nova/cells/messaging.py +++ b/nova/cells/messaging.py @@ -1774,10 +1774,10 @@ class MessageRunner(object): clean_shutdown=True): """Resize an instance in its cell.""" extra_kwargs = dict(flavor=flavor, - extra_instance_updates=extra_instance_updates) + extra_instance_updates=extra_instance_updates, + clean_shutdown=clean_shutdown) self._instance_action(ctxt, instance, 'resize_instance', - extra_kwargs=extra_kwargs, - clean_shutdown=clean_shutdown) + extra_kwargs=extra_kwargs) def live_migrate_instance(self, ctxt, instance, block_migration, disk_over_commit, host_name): diff --git a/nova/tests/unit/cells/test_cells_messaging.py b/nova/tests/unit/cells/test_cells_messaging.py index 6b16b5e9e53d..912d4f785c8c 100644 --- a/nova/tests/unit/cells/test_cells_messaging.py +++ b/nova/tests/unit/cells/test_cells_messaging.py @@ -2133,3 +2133,34 @@ class CellsBroadcastMethodsTestCase(test.TestCase): for response in responses: self.assertIn(response.value_or_raise(), [migrations_from_cell1, migrations_from_cell2]) + + +class CellsPublicInterfacesTestCase(test.TestCase): + """Test case for the public interfaces into cells messaging.""" + def setUp(self): + super(CellsPublicInterfacesTestCase, self).setUp() + fakes.init(self) + self.ctxt = context.RequestContext('fake', 'fake') + self.our_name = 'api-cell' + self.msg_runner = fakes.get_message_runner(self.our_name) + self.state_manager = self.msg_runner.state_manager + + @mock.patch.object(messaging, '_TargetedMessage') + def test_resize_instance(self, mock_message): + instance = objects.Instance(cell_name='api-cell!child-cell') + flavor = 'fake' + extra_instance_updates = {'fake': 'fake'} + clean_shutdown = True + self.msg_runner.resize_instance(self.ctxt, instance, flavor, + extra_instance_updates, + clean_shutdown=clean_shutdown) + extra_kwargs = dict(flavor=flavor, + extra_instance_updates=extra_instance_updates, + clean_shutdown=clean_shutdown) + method_kwargs = {'instance': instance} + method_kwargs.update(extra_kwargs) + mock_message.assert_called_once_with(self.msg_runner, self.ctxt, + 'resize_instance', + method_kwargs, 'down', + instance.cell_name, + need_response=False)