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)
This commit is contained in:
@@ -1467,6 +1467,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': [
|
||||
@@ -1478,6 +1479,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}
|
||||
|
||||
|
||||
@@ -3852,6 +3852,22 @@ 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,
|
||||
'SnapIdList': six.text_type(self.data.snap_id),
|
||||
'is_snap_id': True}
|
||||
|
||||
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)}
|
||||
|
||||
@@ -6847,14 +6847,17 @@ class PowerMaxCommon(object):
|
||||
snap_id_list.append(snapshot_src.get(
|
||||
'snap_id') if self.rest.is_snap_id else snapshot_src.get(
|
||||
'generation'))
|
||||
device_label = device_name.split(':')[1]
|
||||
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,
|
||||
'SnapIdList': ', '.join(
|
||||
six.text_type(v) for v in snap_id_list),
|
||||
'is_snap_id': self.rest.is_snap_id}
|
||||
|
||||
if device_label:
|
||||
metadata['SourceDeviceLabel'] = device_label
|
||||
return metadata
|
||||
|
||||
def _check_and_add_tags_to_storage_array(
|
||||
|
||||
7
releasenotes/notes/bug-1939139-02ab552420813e70.yaml
Normal file
7
releasenotes/notes/bug-1939139-02ab552420813e70.yaml
Normal 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.
|
||||
Reference in New Issue
Block a user