Fix migate_volume API with replication_status ‘not-capable’

When migrating a volume with replication_status = 'not-capable',
migrate_volume api will reject it because 'not-capable' isn't in
the replication_status expected list.
This patch fixes the issue by adding ‘not-capable’ to the expected
replication_status list.

Change-Id: I6bcdbd8343cca237c5f85077273a8ea18c6f534d
Closes-Bug: #1727248
This commit is contained in:
yixuanzhang 2017-10-25 17:25:51 +08:00
parent 859d3ac945
commit 6b5ff682fe
2 changed files with 16 additions and 1 deletions

View File

@ -615,6 +615,18 @@ class AdminActionsTest(BaseAdminTest):
volume = self._migrate_volume_exec(self.ctx, volume, host,
expected_status)
def test_migrate_volume_replication_not_caple_success(self):
expected_status = http_client.ACCEPTED
host = 'test2'
volume = self._migrate_volume_prep()
# current status is available
volume = self._create_volume(self.ctx,
{'provider_location': '',
'attach_status': None,
'replication_status': 'not-capable'})
volume = self._migrate_volume_exec(self.ctx, volume, host,
expected_status)
def test_migrate_volume_as_non_admin(self):
expected_status = http_client.FORBIDDEN
host = 'test2'

View File

@ -1432,7 +1432,10 @@ class API(base.Base):
# Build required conditions for conditional update
expected = {'status': ('available', 'in-use'),
'migration_status': self.AVAILABLE_MIGRATION_STATUS,
'replication_status': (None, 'disabled'),
'replication_status': (
None,
fields.ReplicationStatus.DISABLED,
fields.ReplicationStatus.NOT_CAPABLE),
'consistencygroup_id': (None, ''),
'group_id': (None, '')}