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
This commit is contained in:
Helen Walsh 2021-06-14 11:55:15 +01:00
parent d5f0e51879
commit 1f65c2a92f
3 changed files with 26 additions and 1 deletions

View File

@ -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': {

View File

@ -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

View File

@ -0,0 +1,8 @@
---
fixes:
- |
PowerMax driver `bug #1929429
<https://bugs.launchpad.net/cinder/+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.