Merge "3PAR: Modify update_migrated_volume code to driver"
This commit is contained in:
commit
c38a946481
@ -2917,6 +2917,23 @@ class HPE3PARBaseDriver(object):
|
|||||||
'provider_location': None}
|
'provider_location': None}
|
||||||
self.assertEqual(expected_update, actual_update)
|
self.assertEqual(expected_update, actual_update)
|
||||||
|
|
||||||
|
expected = [
|
||||||
|
mock.call.modifyVolume(
|
||||||
|
'osv-0DM4qZEVSKON-DXN-NwVpw',
|
||||||
|
{'newName': u'tsv-0DM4qZEVSKON-DXN-NwVpw'}),
|
||||||
|
mock.call.modifyVolume(
|
||||||
|
'osv-0DM4qZEVSKON-AAAAAAAAA',
|
||||||
|
{'newName': u'osv-0DM4qZEVSKON-DXN-NwVpw'}),
|
||||||
|
mock.call.modifyVolume(
|
||||||
|
'tsv-0DM4qZEVSKON-DXN-NwVpw',
|
||||||
|
{'newName': u'osv-0DM4qZEVSKON-AAAAAAAAA'})
|
||||||
|
]
|
||||||
|
|
||||||
|
mock_client.assert_has_calls(
|
||||||
|
self.standard_login +
|
||||||
|
expected +
|
||||||
|
self.standard_logout)
|
||||||
|
|
||||||
def test_update_migrated_volume_attached(self):
|
def test_update_migrated_volume_attached(self):
|
||||||
mock_client = self.setup_driver()
|
mock_client = self.setup_driver()
|
||||||
fake_old_volume = {'id': self.VOLUME_ID}
|
fake_old_volume = {'id': self.VOLUME_ID}
|
||||||
|
@ -260,10 +260,11 @@ class HPE3PARCommon(object):
|
|||||||
3.0.33 - Added replication feature in retype flow. bug #1680313
|
3.0.33 - Added replication feature in retype flow. bug #1680313
|
||||||
3.0.34 - Add cloned volume to vvset in online copy. bug #1664464
|
3.0.34 - Add cloned volume to vvset in online copy. bug #1664464
|
||||||
3.0.35 - Add volume to consistency group if flag enabled. bug #1702317
|
3.0.35 - Add volume to consistency group if flag enabled. bug #1702317
|
||||||
|
3.0.36 - Swap volume name in migration. bug #1699733
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERSION = "3.0.35"
|
VERSION = "3.0.36"
|
||||||
|
|
||||||
stats = {}
|
stats = {}
|
||||||
|
|
||||||
@ -1096,7 +1097,7 @@ class HPE3PARCommon(object):
|
|||||||
{'vol': volume_name, 'ex': ex})
|
{'vol': volume_name, 'ex': ex})
|
||||||
return model_update
|
return model_update
|
||||||
|
|
||||||
def _get_3par_vol_name(self, volume_id):
|
def _get_3par_vol_name(self, volume_id, temp_vol=False):
|
||||||
"""Get converted 3PAR volume name.
|
"""Get converted 3PAR volume name.
|
||||||
|
|
||||||
Converts the openstack volume id from
|
Converts the openstack volume id from
|
||||||
@ -1112,7 +1113,13 @@ class HPE3PARCommon(object):
|
|||||||
and / with -
|
and / with -
|
||||||
"""
|
"""
|
||||||
volume_name = self._encode_name(volume_id)
|
volume_name = self._encode_name(volume_id)
|
||||||
return "osv-%s" % volume_name
|
if temp_vol:
|
||||||
|
# is this a temporary volume
|
||||||
|
# this is done during migration
|
||||||
|
prefix = "tsv-%s"
|
||||||
|
else:
|
||||||
|
prefix = "osv-%s"
|
||||||
|
return prefix % volume_name
|
||||||
|
|
||||||
def _get_3par_snap_name(self, snapshot_id, temp_snap=False):
|
def _get_3par_snap_name(self, snapshot_id, temp_snap=False):
|
||||||
snapshot_name = self._encode_name(snapshot_id)
|
snapshot_name = self._encode_name(snapshot_id)
|
||||||
@ -2523,10 +2530,16 @@ class HPE3PARCommon(object):
|
|||||||
if original_volume_status == 'available':
|
if original_volume_status == 'available':
|
||||||
# volume isn't attached and can be updated
|
# volume isn't attached and can be updated
|
||||||
original_name = self._get_3par_vol_name(volume['id'])
|
original_name = self._get_3par_vol_name(volume['id'])
|
||||||
|
temp_name = self._get_3par_vol_name(volume['id'], temp_vol=True)
|
||||||
current_name = self._get_3par_vol_name(new_volume['id'])
|
current_name = self._get_3par_vol_name(new_volume['id'])
|
||||||
try:
|
try:
|
||||||
volumeMods = {'newName': original_name}
|
volumeMods = {'newName': original_name}
|
||||||
|
volumeTempMods = {'newName': temp_name}
|
||||||
|
volumeCurrentMods = {'newName': current_name}
|
||||||
|
# swap volume name in backend
|
||||||
|
self.client.modifyVolume(original_name, volumeTempMods)
|
||||||
self.client.modifyVolume(current_name, volumeMods)
|
self.client.modifyVolume(current_name, volumeMods)
|
||||||
|
self.client.modifyVolume(temp_name, volumeCurrentMods)
|
||||||
LOG.info("Volume name changed from %(tmp)s to %(orig)s",
|
LOG.info("Volume name changed from %(tmp)s to %(orig)s",
|
||||||
{'tmp': current_name, 'orig': original_name})
|
{'tmp': current_name, 'orig': original_name})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user