From d047840da1128b93d6daff8f079f29cefee09bc2 Mon Sep 17 00:00:00 2001 From: Nilesh Thathagar Date: Tue, 2 Sep 2025 18:34:39 +0000 Subject: [PATCH] Dell PowerMax: RDF consistency exempt (follow-up) Main patch id: https://review.opendev.org/c/openstack/cinder/+/915935 Change-Id: Ia425df9d23a48f29df9607394759d6000ec78d78 Signed-off-by: Nilesh Thathagar --- .../dell_emc/powermax/powermax_data.py | 5 ++++ .../dell_emc/powermax/test_powermax_rest.py | 25 +++++++++++++++++-- .../volume/drivers/dell_emc/powermax/rest.py | 13 +++++----- .../bp-dell-powermax-consistency-exempt.yaml | 2 -- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/powermax_data.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/powermax_data.py index 628733179b6..baf03f2a09e 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/powermax_data.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/powermax_data.py @@ -533,6 +533,11 @@ class PowerMaxData(object): rep_extra_specs_metro[utils.METROBIAS] = True rep_extra_specs_metro['replication_enabled'] = ' True' + rep_extra_specs_async = deepcopy(rep_extra_specs) + rep_extra_specs_async[utils.REP_MODE] = utils.REP_ASYNC + rep_extra_specs_async[utils.METROBIAS] = True + rep_extra_specs_async['replication_enabled'] = ' True' + rep_config = { 'array': remote_array, 'srp': srp, 'portgroup': port_group_name_i, 'rdf_group_no': rdf_group_no_1, 'sync_retries': 200, diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py index cab9298d220..7c4c0a889f4 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py @@ -2087,7 +2087,7 @@ class PowerMaxRestTest(test.TestCase): rep_extra_specs = self.data.rep_extra_specs self.rest.srdf_suspend_replication( array_id, sg_name, rdf_group_no, rep_extra_specs) - # Replication mode in this test is synchronous, so the expecation + # Replication mode in this test is synchronous, so the expectation # is that the consistency exempt flag is false. mck_modify.assert_called_once_with( array_id, rdf_group_no, sg_name, @@ -2106,7 +2106,7 @@ class PowerMaxRestTest(test.TestCase): rep_extra_specs = self.data.rep_extra_specs self.rest.srdf_suspend_replication( array_id, sg_name, rdf_group_no, rep_extra_specs) - # Replication mode in this test is synchronous, so the expecation + # Replication mode in this test is synchronous, so the expectation # is that the consistency exempt flag is false. mck_modify.assert_called_once_with( array_id, rdf_group_no, sg_name, @@ -2114,6 +2114,27 @@ class PowerMaxRestTest(test.TestCase): 'action': 'Suspend'}, rep_extra_specs, 'Suspend SRDF Group Replication') + @mock.patch.object(rest.PowerMaxRest, 'srdf_modify_group') + @mock.patch.object(rest.PowerMaxRest, + 'get_storage_group_rdf_group_state', + return_value=[utils.RDF_SUSPENDED_STATE, + utils.RDF_CONSISTENT_STATE]) + def test_srdf_suspend_metro_replication_dual_states(self, mck_get, + mck_modify): + array_id = self.data.array + rdf_group_no = self.data.rdf_group_no_1 + sg_name = self.data.default_sg_re_enabled + rep_extra_specs = self.data.rep_extra_specs_async + self.rest.srdf_suspend_replication( + array_id, sg_name, rdf_group_no, rep_extra_specs) + # Replication mode in this test is asynchronous, so the expectation + # is that the consistency exempt flag is true. + mck_modify.assert_called_once_with( + array_id, rdf_group_no, sg_name, + {'suspend': {'force': 'true', 'consExempt': 'true'}, + 'action': 'Suspend'}, + rep_extra_specs, 'Suspend SRDF Group Replication') + @mock.patch.object(rest.PowerMaxRest, 'srdf_modify_group') @mock.patch.object(rest.PowerMaxRest, 'get_storage_group_rdf_group_state', return_value=[utils.RDF_SUSPENDED_STATE]) diff --git a/cinder/volume/drivers/dell_emc/powermax/rest.py b/cinder/volume/drivers/dell_emc/powermax/rest.py index 2f52e82c7d9..5c9eb1344ff 100644 --- a/cinder/volume/drivers/dell_emc/powermax/rest.py +++ b/cinder/volume/drivers/dell_emc/powermax/rest.py @@ -3019,8 +3019,7 @@ class PowerMaxRest(object): array_id, storage_group, rdf_group_no, rep_extra_specs['rep_mode']) payload = {"suspend": {"force": "true"}, "action": "Suspend"} - payload["suspend"]["consExempt"] = ( - "true" if cons_exempt else "false") + payload["suspend"]["consExempt"] = cons_exempt self.srdf_modify_group( array_id, rdf_group_no, storage_group, payload, rep_extra_specs, @@ -3037,13 +3036,12 @@ class PowerMaxRest(object): :returns: A boolean indicating if consistency is exempt """ if not rep_mode: - return False + return "false" resource = ('storagegroup/%(sg)s/rdf_group/%(rdfg)s' % { 'sg': storage_group, 'rdfg': rdf_group_no}) rdf_group = self.get_resource(array_id, REPLICATION, resource) - modes = list(rep_mode) - + modes = [rep_mode] if rdf_group and rdf_group.get('modes'): modes.append(rdf_group.get('modes')) # Ensure we don't see the error message: @@ -3052,7 +3050,7 @@ class PowerMaxRest(object): # asynchronous mode" cons_exempt = utils.REP_ASYNC in modes LOG.debug("Consistency exempt: %s", cons_exempt) - return cons_exempt + return self._bool_to_str(cons_exempt) def srdf_resume_replication(self, array_id, storage_group, rdf_group_no, rep_extra_specs, async_call=True): @@ -3633,6 +3631,9 @@ class PowerMaxRest(object): self.ucode_minor_level >= utils.UCODE_5978_HICKORY) or ( self.ucode_major_level >= utils.UCODE_6079) + def _bool_to_str(self, param): + return "true" if param else "false" + @staticmethod def _check_force(extra_specs, force_flag=False): """Determine whether force should be used diff --git a/releasenotes/notes/bp-dell-powermax-consistency-exempt.yaml b/releasenotes/notes/bp-dell-powermax-consistency-exempt.yaml index e552c8c47eb..b5c06ab0b9f 100644 --- a/releasenotes/notes/bp-dell-powermax-consistency-exempt.yaml +++ b/releasenotes/notes/bp-dell-powermax-consistency-exempt.yaml @@ -13,5 +13,3 @@ features: volumes are added to SRDF groups, but not when volumes are removed. This incurs an unnecessary performance penalty that is resolved by this change. - - Blueprint: dell-powermax-srdf-exempt \ No newline at end of file