Merge "Follow up change for share server migration"

This commit is contained in:
Zuul 2020-09-22 22:28:43 +00:00 committed by Gerrit Code Review
commit 8caa7e3a63
5 changed files with 7 additions and 6 deletions

View File

@ -2600,8 +2600,7 @@ class API(base.Base):
'task_state': dest_share_server['task_state'],
}
# Source server still exists so it must be in 'server_migrating' status
if (share_server and
share_server['status'] != constants.STATUS_SERVER_MIGRATING):
if share_server['status'] != constants.STATUS_SERVER_MIGRATING:
msg = _("Migration progress of share server %s cannot be "
"obtained. The provided share server is not being "
"migrated.") % share_server['id']

View File

@ -1103,7 +1103,7 @@ class ShareManager(manager.SchedulerDependentManager):
def _cast_access_rules_to_readonly(self, context, src_share_instance,
share_server, dest_host=None):
self._cast_access_rules_to_readonly_for_server(
context, [src_share_instance], share_server, dest_host)
context, [src_share_instance], share_server, dest_host=dest_host)
def _cast_access_rules_to_readonly_for_server(
self, context, src_share_instances, share_server, dest_host=None):
@ -4873,7 +4873,7 @@ class ShareManager(manager.SchedulerDependentManager):
# driver doesn't support 'writable'.
self._cast_access_rules_to_readonly_for_server(
context, share_instances, source_share_server,
source_share_server['host'])
dest_host=source_share_server['host'])
LOG.debug("Initiating driver migration for share server %s.",
source_share_server['id'])
@ -5012,7 +5012,7 @@ class ShareManager(manager.SchedulerDependentManager):
try:
if not self.driver.driver_handles_share_servers:
LOG.error('This operation is supported only on backends that '
'handles share servers.')
'handle share servers.')
raise
self._share_server_migration_start_driver(

View File

@ -2966,6 +2966,8 @@ class ShareServerTaskState(BaseMigrationChecks):
for ss in engine.execute(ss_table.select()):
self.test_case.assertTrue(hasattr(ss, 'task_state'))
self.test_case.assertTrue(hasattr(ss, 'source_share_server_id'))
self.test_case.assertIsNone(ss['task_state'])
self.test_case.assertIsNone(ss['source_share_server_id'])
def check_downgrade(self, engine):
ss_table = utils.load_table('share_servers', engine)

View File

@ -8032,7 +8032,7 @@ class ShareManagerTestCase(test.TestCase):
(self.share_manager._cast_access_rules_to_readonly_for_server.
assert_called_once_with(
self.context, fake_share_instances, fake_old_share_server,
fake_old_share_server['host']))
dest_host=fake_old_share_server['host']))
else:
(self.share_manager._cast_access_rules_to_readonly_for_server.
assert_not_called())