Merge "PowerMax Driver - Fix for force flag"

This commit is contained in:
Zuul 2023-03-15 14:31:34 +00:00 committed by Gerrit Code Review
commit 42d5d1d648
3 changed files with 52 additions and 6 deletions

View File

@ -2554,3 +2554,28 @@ class PowerMaxRestTest(test.TestCase):
self.data.array, self.data.device_id, self.data.array, self.data.device_id,
self.data.test_snapshot_snap_name) self.data.test_snapshot_snap_name)
self.assertEqual('0', snap_id) self.assertEqual('0', snap_id)
def test_check_force(self):
extra_specs = {'pool_name': 'Diamond+DSS+SRP_1+000197800123',
'slo': 'Diamond',
'srp': 'SRP_1',
'array': '000123456789',
'interval': 3,
'retries': 120}
self.assertEqual(
'false', self.rest._check_force(extra_specs))
self.assertEqual(
'false', self.rest._check_force(
self.data.extra_specs, force_flag=False))
self.assertEqual(
'true', self.rest._check_force(
self.data.extra_specs, force_flag=True))
extra_specs[utils.FORCE_VOL_EDIT] = True
self.assertEqual(
'true', self.rest._check_force(extra_specs))
self.assertEqual(
'true', self.rest._check_force(
extra_specs, force_flag=False))
self.assertEqual(
'true', self.rest._check_force(
extra_specs, force_flag=True))

View File

@ -1257,7 +1257,7 @@ class PowerMaxRest(object):
if not isinstance(device_id, list): if not isinstance(device_id, list):
device_id = [device_id] device_id = [device_id]
force_add = "true" if force else "false" force_add = self._check_force(extra_specs, force)
payload = ({"executionOption": "ASYNCHRONOUS", payload = ({"executionOption": "ASYNCHRONOUS",
"editStorageGroupActionParam": { "editStorageGroupActionParam": {
@ -1282,8 +1282,7 @@ class PowerMaxRest(object):
:param extra_specs: the extra specifications :param extra_specs: the extra specifications
""" """
force_vol_edit = ( force_vol_edit = self._check_force(extra_specs)
"true" if utils.FORCE_VOL_EDIT in extra_specs else "false")
if not isinstance(device_id, list): if not isinstance(device_id, list):
device_id = [device_id] device_id = [device_id]
payload = ({"executionOption": "ASYNCHRONOUS", payload = ({"executionOption": "ASYNCHRONOUS",
@ -1410,7 +1409,7 @@ class PowerMaxRest(object):
:param extra_specs: extra specifications :param extra_specs: extra specifications
:param force: force flag (necessary on a detach) :param force: force flag (necessary on a detach)
""" """
force_flag = "true" if force else "false" force_flag = self._check_force(extra_specs, force)
payload = ({"executionOption": "ASYNCHRONOUS", payload = ({"executionOption": "ASYNCHRONOUS",
"editStorageGroupActionParam": { "editStorageGroupActionParam": {
"moveVolumeToStorageGroupParam": { "moveVolumeToStorageGroupParam": {
@ -2200,8 +2199,7 @@ class PowerMaxRest(object):
""" """
action, operation, payload = '', '', {} action, operation, payload = '', '', {}
copy = 'true' if copy else 'false' copy = 'true' if copy else 'false'
force = ( force = self._check_force(extra_specs)
"true" if utils.FORCE_VOL_EDIT in extra_specs else "false")
if link: if link:
action = "Link" action = "Link"
@ -3562,3 +3560,18 @@ class PowerMaxRest(object):
return (self.ucode_major_level >= utils.UCODE_5978 and return (self.ucode_major_level >= utils.UCODE_5978 and
self.ucode_minor_level >= utils.UCODE_5978_HICKORY) or ( self.ucode_minor_level >= utils.UCODE_5978_HICKORY) or (
self.ucode_major_level >= utils.UCODE_6079) self.ucode_major_level >= utils.UCODE_6079)
@staticmethod
def _check_force(extra_specs, force_flag=False):
"""Determine whether force should be used
Returns 'true' if force_flag is True or FORCE_VOL_EDIT is set in
extra_specs, otherwise returns 'false'.
:param extra_specs: extra specs dict
:param force_flag: force flag boolean
:returns: str (true or false)
"""
return "true" if force_flag else (
"true" if utils.FORCE_VOL_EDIT in extra_specs else "false")

View File

@ -0,0 +1,8 @@
---
fixes:
- |
`Dell PowerMax Driver Bug #1981420 <https://bugs.launchpad.net/cinder/+bug/1981420>`_:
Fixed issue faced while creating synchronous volume which was caused by
incorrect handling of the force flag. This is corrected by checking volume
type extra specs for the value of "force_vol_edit" parameter along with the
"force" parameter.