Merge "func: Introduce a server_expected_state kwarg to InstanceHelperMixin._live_migrate" into stable/ussuri

This commit is contained in:
Zuul 2020-09-10 18:52:54 +00:00 committed by Gerrit Code Review
commit 4b405e9e92
2 changed files with 6 additions and 9 deletions

View File

@ -167,16 +167,12 @@ class TestVolAttachmentsDuringLiveMigration(
# Migrate the instance and wait until the migration errors out thanks # Migrate the instance and wait until the migration errors out thanks
# to our mocked version of live_migration raising TestingException # to our mocked version of live_migration raising TestingException
self.api.post_server_action( self._live_migrate(server, 'error', server_expected_state='ERROR')
server['id'],
{'os-migrateLive': {'host': None, 'block_migration': 'auto'}})
self._wait_for_migration_status(server, ['error'])
# Assert that we called the fake live_migration method # Assert that we called the fake live_migration method
mock_lm.assert_called_once() mock_lm.assert_called_once()
# Assert that the instance is listed as ERROR on the source # Assert that the instance is on the source
self._wait_for_state_change(server, 'ERROR')
server = self.api.get_server(server['id']) server = self.api.get_server(server['id'])
self.assertEqual(src_host, server['OS-EXT-SRV-ATTR:host']) self.assertEqual(src_host, server['OS-EXT-SRV-ATTR:host'])

View File

@ -407,13 +407,14 @@ class InstanceHelperMixin(object):
} }
self._migrate_or_resize(server, resize_req) self._migrate_or_resize(server, resize_req)
def _live_migrate(self, server, migration_final_status): def _live_migrate(self, server, migration_expected_state,
server_expected_state='ACTIVE'):
self.api.post_server_action( self.api.post_server_action(
server['id'], server['id'],
{'os-migrateLive': {'host': None, {'os-migrateLive': {'host': None,
'block_migration': 'auto'}}) 'block_migration': 'auto'}})
self._wait_for_state_change(server, 'ACTIVE') self._wait_for_state_change(server, server_expected_state)
self._wait_for_migration_status(server, [migration_final_status]) self._wait_for_migration_status(server, [migration_expected_state])
class _IntegratedTestBase(test.TestCase, InstanceHelperMixin): class _IntegratedTestBase(test.TestCase, InstanceHelperMixin):