Added support for live migration on non-shared storage
Watcher applier should be able to live migrate instances on any storage type. To do this watcher will catch error 400 returned from nova if we try to live migrate instance which is not on shared storage and live migrate instance using block_migrate. Added unit tests, changed action in watcher applier. Closes-bug: #1549307 Change-Id: I97e583c9b4a0bb9daa1d39e6d652d6474a5aaeb1
This commit is contained in:
@@ -157,7 +157,10 @@ class TestMigration(base.TestCase):
|
||||
def test_execute_live_migration(self):
|
||||
self.m_helper.find_instance.return_value = self.INSTANCE_UUID
|
||||
|
||||
self.action.execute()
|
||||
try:
|
||||
self.action.execute()
|
||||
except Exception as exc:
|
||||
self.fail(exc)
|
||||
|
||||
self.m_helper.live_migrate_instance.assert_called_once_with(
|
||||
instance_id=self.INSTANCE_UUID,
|
||||
@@ -173,3 +176,31 @@ class TestMigration(base.TestCase):
|
||||
instance_id=self.INSTANCE_UUID,
|
||||
dest_hostname="hypervisor1-hostname"
|
||||
)
|
||||
|
||||
def test_live_migrate_non_shared_storage_instance(self):
|
||||
self.m_helper.find_instance.return_value = self.INSTANCE_UUID
|
||||
|
||||
self.m_helper.live_migrate_instance.side_effect = [
|
||||
nova_helper.nvexceptions.ClientException(400, "BadRequest"), True]
|
||||
|
||||
try:
|
||||
self.action.execute()
|
||||
except Exception as exc:
|
||||
self.fail(exc)
|
||||
|
||||
self.m_helper.live_migrate_instance.assert_has_calls([
|
||||
mock.call(instance_id=self.INSTANCE_UUID,
|
||||
dest_hostname="hypervisor2-hostname"),
|
||||
mock.call(instance_id=self.INSTANCE_UUID,
|
||||
dest_hostname="hypervisor2-hostname",
|
||||
block_migration=True)
|
||||
])
|
||||
|
||||
expected = [mock.call.first(instance_id=self.INSTANCE_UUID,
|
||||
dest_hostname="hypervisor2-hostname"),
|
||||
mock.call.second(instance_id=self.INSTANCE_UUID,
|
||||
dest_hostname="hypervisor2-hostname",
|
||||
block_migration=True)
|
||||
]
|
||||
self.m_helper.live_migrate_instance.mock_calls == expected
|
||||
self.assertEqual(2, self.m_helper.live_migrate_instance.call_count)
|
||||
|
||||
Reference in New Issue
Block a user