PowerMax Driver - Fix for create snapshot

Payload response change from REST means that the
Device Label no longer exists in the format expected and
causes an IndexError exception. This is the case in PowerMaxOS
5978.711 and later.

Closes-Bug: #1939139

Change-Id: If465bc719cea2d4e85b37527f3f7ac916b5de638
(cherry picked from commit 672a0e9798)
(cherry picked from commit a366ed53b1)
(cherry picked from commit 37be715cc7)
(cherry picked from commit a56256c3d8)
This commit is contained in:
Helen Walsh 2021-03-25 12:57:02 +00:00
parent d8d84b7c65
commit 9c770d9749
6 changed files with 37 additions and 7 deletions

View File

@ -1216,6 +1216,7 @@ class PowerMaxData(object):
snap_device_label = ('%(dev)s:%(label)s' % {'dev': device_id,
'label': managed_snap_id})
priv_snap_response = {
'deviceName': snap_device_label, 'snapshotLnks': [],
'snapshotSrcs': [
@ -1227,6 +1228,9 @@ class PowerMaxData(object):
'snapshotName': test_snapshot_snap_name,
'state': 'Established'}]}
priv_snap_response_no_label = deepcopy(priv_snap_response)
priv_snap_response_no_label.update({'deviceName': device_id})
volume_metadata = {
'DeviceID': device_id, 'ArrayID': array, 'ArrayModel': array_model}

View File

@ -3036,6 +3036,20 @@ class PowerMaxCommonTest(test.TestCase):
array, device_id, snap_name)
self.assertEqual(ref_metadata, act_metadata)
@mock.patch.object(
rest.PowerMaxRest, 'get_volume_snap_info',
return_value=(tpd.PowerMaxData.priv_snap_response_no_label))
def test_get_snapshot_metadata_no_label(self, mck_snap):
array = self.data.array
device_id = self.data.device_id
snap_name = self.data.test_snapshot_snap_name
ref_metadata = {'SnapshotLabel': snap_name,
'SourceDeviceID': device_id}
act_metadata = self.common.get_snapshot_metadata(
array, device_id, snap_name)
self.assertEqual(ref_metadata, act_metadata)
def test_update_metadata(self):
model_update = {'provider_location': six.text_type(
self.data.provider_location)}

View File

@ -5514,10 +5514,13 @@ class PowerMaxCommon(object):
:returns: dict -- volume metadata
"""
snap_info = self.rest.get_volume_snap_info(array, device_id)
device_name = snap_info['deviceName']
device_label = device_name.split(':')[1]
device_name = snap_info.get('deviceName')
try:
device_label = device_name.split(':')[1] if device_name else None
except IndexError:
device_label = None
metadata = {'SnapshotLabel': snap_name,
'SourceDeviceID': device_id,
'SourceDeviceLabel': device_label}
'SourceDeviceID': device_id}
if device_label:
metadata['SourceDeviceLabel'] = device_label
return metadata

View File

@ -124,9 +124,10 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
4.1.6 - Pools bug fix allowing 'None' variants (bug #1873253)
4.1.7 - Fix to enable legacy volumes to live migrate (#1867163)
4.1.8 - Block retype to some in-use replicated modes (#1899137)
4.1.9 - Fix for create snapshot (#1939139)
"""
VERSION = "4.1.8"
VERSION = "4.1.9"
# ThirdPartySystems wiki
CI_WIKI_NAME = "EMC_VMAX_CI"

View File

@ -129,9 +129,10 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
4.1.6 - Pools bug fix allowing 'None' variants (bug #1873253)
4.1.7 - Fix to enable legacy volumes to live migrate (#1867163)
4.1.8 - Block retype to some in-use replicated modes (#1899137)
4.1.9 - Fix for create snapshot (#1939139)
"""
VERSION = "4.1.8"
VERSION = "4.1.9"
# ThirdPartySystems wiki
CI_WIKI_NAME = "EMC_VMAX_CI"

View File

@ -0,0 +1,7 @@
---
fixes:
- |
PowerMax driver `bug #1939139
<https://bugs.launchpad.net/cinder/+bug/1939139>`_: Fix
on create snapshot operation that exists when using PowerMax OS
5978.711 and later.