diff --git a/nova/compute/cells_api.py b/nova/compute/cells_api.py index 50ad4826bc..118ac6e3c1 100644 --- a/nova/compute/cells_api.py +++ b/nova/compute/cells_api.py @@ -261,11 +261,12 @@ class ComputeCellsAPI(compute_api.API): self._cast_to_cells(context, instance, 'restore') @check_instance_cell - def evacuate(self, context, instance, *args, **kwargs): + def evacuate(self, context, instance, host, *args, **kwargs): """Evacuate the given instance with the provided attributes.""" - super(ComputeCellsAPI, self).evacuate(context, instance, *args, - **kwargs) - self._cast_to_cells(context, instance, 'evacuate', *args, **kwargs) + if host: + cell_path, host = cells_utils.split_cell_and_item(host) + self._cast_to_cells(context, instance, 'evacuate', + host, *args, **kwargs) @check_instance_cell def add_fixed_ip(self, context, instance, *args, **kwargs): diff --git a/nova/tests/unit/compute/test_compute_cells.py b/nova/tests/unit/compute/test_compute_cells.py index 7b7c7ed2e4..31cbe5c250 100644 --- a/nova/tests/unit/compute/test_compute_cells.py +++ b/nova/tests/unit/compute/test_compute_cells.py @@ -131,7 +131,16 @@ class CellsComputeAPITestCase(test_compute.ComputeAPITestCase): self.skipTest("Test is incompatible with cells.") def test_evacuate(self): - self.skipTest("Test is incompatible with cells.") + @mock.patch.object(compute_api.API, 'evacuate') + def _test(mock_evacuate): + instance = objects.Instance(uuid=uuids.evacuate_instance, + cell_name='fake_cell_name') + dest_host = 'fake_cell_name@fakenode2' + self.compute_api.evacuate(self.context, instance, host=dest_host) + mock_evacuate.assert_called_once_with( + self.context, instance, 'fakenode2') + + _test() def test_error_evacuate(self): self.skipTest("Test is incompatible with cells.")