Use migration_status during volume migrating and retyping
When swapping volumes Nova has to identify if the swap itself is related to an underlying migration or retype of the volume by Cinder. Nova would previously use the status of the volume to determine if the volume was retyping or migrating. However in the migration case where a volume is moved directly between hosts the volume is never given a status of migrating by Cinder leading to Nova never calling the os-migrate_volume_completion cinder API to complete the migration. This change switches Nova to use the migration_status of the volume to ensure that this API is called for both retypes and migrations. Depends-On: https://review.openstack.org/#/c/639331/ Change-Id: I1bdf3431bda2da98380e0dcaa9f952e6768ca3af Closes-bug: #1803961
This commit is contained in:
parent
d42a007425
commit
53c3cfa7a0
|
@ -5966,9 +5966,9 @@ class ComputeManager(manager.Manager):
|
|||
# new style attachments (v3.44). Once we drop support for old style
|
||||
# attachments we could think about cleaning up the cinder-initiated
|
||||
# swap volume API flows.
|
||||
is_cinder_migration = (
|
||||
True if old_volume['status'] in ('retyping',
|
||||
'migrating') else False)
|
||||
is_cinder_migration = False
|
||||
if 'migration_status' in old_volume:
|
||||
is_cinder_migration = old_volume['migration_status'] == 'migrating'
|
||||
old_vol_size = old_volume['size']
|
||||
new_volume = self.volume_api.get(context, new_volume_id)
|
||||
new_vol_size = new_volume['size']
|
||||
|
|
|
@ -2336,11 +2336,11 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
|
|||
connection_info='{"data": {}}', volume_size=1)
|
||||
old_volume = {
|
||||
'id': uuids.old_volume_id, 'size': 1, 'status': 'retyping',
|
||||
'multiattach': False
|
||||
'migration_status': 'migrating', 'multiattach': False
|
||||
}
|
||||
new_volume = {
|
||||
'id': uuids.new_volume_id, 'size': 1, 'status': 'reserved',
|
||||
'multiattach': False
|
||||
'migration_status': 'migrating', 'multiattach': False
|
||||
}
|
||||
attachment_update.return_value = {"connection_info": {"data": {}}}
|
||||
get_bdm.return_value = bdm
|
||||
|
@ -2482,12 +2482,12 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
|
|||
attachment_id=uuids.old_attachment_id,
|
||||
connection_info='{"data": {}}')
|
||||
old_volume = {
|
||||
'id': uuids.old_volume_id, 'size': 1, 'status': 'migrating',
|
||||
'multiattach': False
|
||||
'id': uuids.old_volume_id, 'size': 1, 'status': 'in-use',
|
||||
'migration_status': 'migrating', 'multiattach': False
|
||||
}
|
||||
new_volume = {
|
||||
'id': uuids.new_volume_id, 'size': 1, 'status': 'reserved',
|
||||
'multiattach': False
|
||||
'migration_status': 'migrating', 'multiattach': False
|
||||
}
|
||||
get_bdm.return_value = bdm
|
||||
get_volume.side_effect = (old_volume, new_volume)
|
||||
|
|
|
@ -327,6 +327,9 @@ def _untranslate_volume_summary_view(context, vol):
|
|||
d['shared_targets'] = vol.shared_targets
|
||||
d['service_uuid'] = vol.service_uuid
|
||||
|
||||
if hasattr(vol, 'migration_status'):
|
||||
d['migration_status'] = vol.migration_status
|
||||
|
||||
return d
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue