Browse Source

Merge "Revert "Don't revert Migrate action""

changes/72/738972/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
f7f5659bca
2 changed files with 24 additions and 1 deletions
  1. +1
    -1
      watcher/applier/actions/migration.py
  2. +23
    -0
      watcher/tests/applier/actions/test_migration.py

+ 1
- 1
watcher/applier/actions/migration.py View File

@@ -186,7 +186,7 @@ class Migrate(base.BaseAction):
return self.migrate(destination=self.destination_node)

def revert(self):
LOG.info('Migrate action do not revert!')
return self.migrate(destination=self.source_node)

def abort(self):
nova = nova_helper.NovaHelper(osc=self.osc)


+ 23
- 0
watcher/tests/applier/actions/test_migration.py View File

@@ -185,6 +185,29 @@ class TestMigration(base.TestCase):
dest_hostname="compute2-hostname"
)

def test_revert_live_migration(self):
self.m_helper.find_instance.return_value = self.INSTANCE_UUID

self.action.revert()

self.m_helper_cls.assert_called_once_with(osc=self.m_osc)
self.m_helper.live_migrate_instance.assert_called_once_with(
instance_id=self.INSTANCE_UUID,
dest_hostname="compute1-hostname"
)

def test_revert_cold_migration(self):
self.m_helper.find_instance.return_value = self.INSTANCE_UUID

self.action_cold.revert()

self.m_helper_cls.assert_called_once_with(osc=self.m_osc)
self.m_helper.watcher_non_live_migrate_instance.\
assert_called_once_with(
instance_id=self.INSTANCE_UUID,
dest_hostname="compute1-hostname"
)

def test_abort_live_migrate(self):
migration = mock.MagicMock()
migration.id = "2"


Loading…
Cancel
Save