Merge "Fix evacuate support with Nova cells v1" into stable/liberty

This commit is contained in:
Jenkins 2016-03-04 22:07:08 +00:00 committed by Gerrit Code Review
commit 3580dfce43
2 changed files with 15 additions and 5 deletions

View File

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

View File

@ -135,7 +135,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='fake-uuid',
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.")