PowerMax Driver - Fix for legacy PowerMax OS around generations
In the previous version of PowerMax OS generations of snapVx were used instead of unique snap ids which were just introduced. A generation can be returned as a 0 integer which equates to False in python. The fix is to convert the int to a string if it is returned from REST as an int. Closes-Bug: #1938572 Change-Id: I5b660776190f3026296d6d3237bd3b0d609f769f
This commit is contained in:
parent
81f2aaeea9
commit
ee1b5e2b75
@ -2431,3 +2431,25 @@ class PowerMaxRestTest(test.TestCase):
|
|||||||
exception.VolumeBackendAPIException,
|
exception.VolumeBackendAPIException,
|
||||||
self.rest.get_ip_interface_physical_port,
|
self.rest.get_ip_interface_physical_port,
|
||||||
array_id, virtual_port, ip_address)
|
array_id, virtual_port, ip_address)
|
||||||
|
|
||||||
|
@mock.patch.object(rest.PowerMaxRest, 'get_volume_snaps',
|
||||||
|
return_value=[{'snap_name': 'snap_name',
|
||||||
|
'snap_id': tpd.PowerMaxData.snap_id}])
|
||||||
|
def test_get_snap_id(self, mock_snaps):
|
||||||
|
snap_id = self.rest.get_snap_id(
|
||||||
|
self.data.array, self.data.device_id,
|
||||||
|
self.data.test_snapshot_snap_name)
|
||||||
|
self.assertEqual(self.data.snap_id, snap_id)
|
||||||
|
|
||||||
|
@mock.patch.object(rest.PowerMaxRest, 'get_volume_snaps',
|
||||||
|
side_effect=[[{'snap_name': 'generation_int',
|
||||||
|
'generation': 0}],
|
||||||
|
[{'snap_name': 'generation_string',
|
||||||
|
'generation': '0'}]])
|
||||||
|
def test_get_snap_id_legacy_generation(self, mock_snaps):
|
||||||
|
self.rest.is_snap_id = False
|
||||||
|
for x in range(0, 2):
|
||||||
|
snap_id = self.rest.get_snap_id(
|
||||||
|
self.data.array, self.data.device_id,
|
||||||
|
self.data.test_snapshot_snap_name)
|
||||||
|
self.assertEqual('0', snap_id)
|
||||||
|
@ -3397,7 +3397,7 @@ class PowerMaxRest(object):
|
|||||||
message=exception_message)
|
message=exception_message)
|
||||||
else:
|
else:
|
||||||
return snapshots[0].get('snap_id') if self.is_snap_id else (
|
return snapshots[0].get('snap_id') if self.is_snap_id else (
|
||||||
snapshots[0].get('generation'))
|
self.utils.convert_to_string(snapshots[0].get('generation')))
|
||||||
|
|
||||||
def get_major_minor_ucode(self, array):
|
def get_major_minor_ucode(self, array):
|
||||||
"""Get the major and minor parts of the ucode
|
"""Get the major and minor parts of the ucode
|
||||||
|
@ -2086,3 +2086,12 @@ class PowerMaxUtils(object):
|
|||||||
service_level = str()
|
service_level = str()
|
||||||
|
|
||||||
return array_id, srp, service_level, workload
|
return array_id, srp, service_level, workload
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def convert_to_string(in_value):
|
||||||
|
"""Convert to string if value is an int
|
||||||
|
|
||||||
|
:param in_value: the input (most likely a str or int)
|
||||||
|
:returns: str
|
||||||
|
"""
|
||||||
|
return in_value if isinstance(in_value, str) else str(in_value)
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
PowerMax driver `bug #1938572
|
||||||
|
<https://bugs.launchpad.net/cinder/+bug/1938572>`_ :
|
||||||
|
Legacy PowerMax OS fix to convert an int to a string if the generation
|
||||||
|
of snapVX is returned as an int from REST so that a 0 does not equate
|
||||||
|
to False in python.
|
Loading…
Reference in New Issue
Block a user