From 1f65c2a92fe3931791fca81038a27f81e1ca28fd Mon Sep 17 00:00:00 2001 From: Helen Walsh Date: Mon, 14 Jun 2021 11:55:15 +0100 Subject: [PATCH] PowerMax Driver - Allow for case mismatch in SGs When checking if a storage group is a child of a parent storage group the check is currently case sensitive. We should allow for a pattern match that is not case sensitive. For example, myStorageGroup should equal MYSTORAGEGROUP or mystoragegroup. Closes-Bug: #1929429 Change-Id: I8dd114fedece8e9d8f85c1ed237c31aede907d67 --- .../dell_emc/powermax/test_powermax_rest.py | 16 ++++++++++++++++ cinder/volume/drivers/dell_emc/powermax/rest.py | 3 ++- .../notes/bug1929429-e749f5e5a242a599.yaml | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug1929429-e749f5e5a242a599.yaml 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 23101c80f92..d62ca56cdcd 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 @@ -628,6 +628,22 @@ class PowerMaxRestTest(test.TestCase): self.assertTrue(is_child1) self.assertFalse(is_child2) + def test_is_child_sg_in_parent_sg_case_not_matching(self): + lower_case_host = 'OS-hostx-SRP_1-DiamondDSS-os-fibre-PG' + + is_child1 = self.rest.is_child_sg_in_parent_sg( + self.data.array, lower_case_host, + self.data.parent_sg_f) + self.assertTrue(is_child1) + + def test_is_child_sg_in_parent_sg_spelling_mistake(self): + lower_case_host = 'OS-hosty-SRP_1-DiamondDSS-os-fiber-PG' + + is_child1 = self.rest.is_child_sg_in_parent_sg( + self.data.array, lower_case_host, + self.data.parent_sg_f) + self.assertFalse(is_child1) + def test_add_child_sg_to_parent_sg(self): payload = {'editStorageGroupActionParam': { 'expandStorageGroupParam': { diff --git a/cinder/volume/drivers/dell_emc/powermax/rest.py b/cinder/volume/drivers/dell_emc/powermax/rest.py index 26692b59e2a..6837f9f1610 100644 --- a/cinder/volume/drivers/dell_emc/powermax/rest.py +++ b/cinder/volume/drivers/dell_emc/powermax/rest.py @@ -925,7 +925,8 @@ class PowerMaxRest(object): parent_sg = self.get_storage_group(array, parent_name) if parent_sg and parent_sg.get('child_storage_group'): child_sg_list = parent_sg['child_storage_group'] - if child_name in child_sg_list: + if child_name.lower() in ( + child.lower() for child in child_sg_list): return True return False diff --git a/releasenotes/notes/bug1929429-e749f5e5a242a599.yaml b/releasenotes/notes/bug1929429-e749f5e5a242a599.yaml new file mode 100644 index 00000000000..d7a7e3d6e5e --- /dev/null +++ b/releasenotes/notes/bug1929429-e749f5e5a242a599.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + PowerMax driver `bug #1929429 + `_: Fixes + child/parent storage group check so that a pattern match + is not case sensitive. For example, myStorageGroup should + equal MYSTORAGEGROUP and mystoragegroup.