From 61e7d1f83c0ca6bd821da0d8f398e4154868cdd7 Mon Sep 17 00:00:00 2001 From: Atsushi Kawai Date: Fri, 7 Apr 2023 10:35:04 +0900 Subject: [PATCH] HPE XP and NEC V: Host group name is not correct Host group[1] name formats, which is managed by cinder driver, for each storage models must be: ``HBSD-xxx`` for Hitachi storage(``xxx`` is WWPN of target host on FC, or IP address of target host) ``HPEXP-xxx`` for HPE-XP storage ``NEC-xxx`` for NEC V storage , but the format `HBSD-xxx` is used for OEM storage models because a bug in the merged patch https://review.opendev.org/c/openstack/cinder/+/866526 overwrites the prefix for Hitachi storage. It should be fixed to use original prefixes. [1] ``Host group``(or ``iSCSI target``), which is one of Hitachi and OEM storage parameter, is a group of multiple server hosts connecting to same storage port. Following site would be help to know what host group is: https://knowledge.hitachivantara.com/Documents/Management_Software/SVOS/9.1.x/Volume_Management_-_VSP_G130%2C_G%2F%2FF350%2C_G%2F%2FF370%2C_G%2F%2FF700%2C_G%2F%2FF900/Provisioning/11_About_LUN_Manager%2C_logical_units_(LUs)%2C_and_host_groups Closes-Bug: #2012515 Change-Id: I1c9677112caa0808dff17cbde2db6afbe25a2129 --- .../drivers/hpe/xp/test_hpe_xp_rest_fc.py | 3 ++ .../drivers/hpe/xp/test_hpe_xp_rest_iscsi.py | 3 ++ cinder/volume/drivers/hitachi/hbsd_common.py | 51 +++++++++---------- ...o-use-correct-HGname-78c3c47dcf984ddf.yaml | 6 +++ 4 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 releasenotes/notes/hitachi-vsp-fix-to-use-correct-HGname-78c3c47dcf984ddf.yaml diff --git a/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_fc.py b/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_fc.py index 1499964c3aa..a08d085e110 100644 --- a/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_fc.py +++ b/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_fc.py @@ -578,6 +578,9 @@ class HPEXPRESTFCDriverTest(test.TestCase): self.assertEqual( {CONFIG_MAP['port_id']: CONFIG_MAP['target_wwn']}, drv.common.storage_info['wwns']) + self.assertEqual(CONFIG_MAP['host_grp_name'], + drv.common.format_info['group_name_format'].format( + wwn=min(DEFAULT_CONNECTOR['wwpns']))) self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(8, request.call_count) # stop the Loopingcall within the do_setup treatment diff --git a/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_iscsi.py b/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_iscsi.py index 18e933d8085..da248f7176b 100644 --- a/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_iscsi.py +++ b/cinder/tests/unit/volume/drivers/hpe/xp/test_hpe_xp_rest_iscsi.py @@ -490,6 +490,9 @@ class HPEXPRESTISCSIDriverTest(test.TestCase): 'ip': CONFIG_MAP['ipv4Address'], 'port': CONFIG_MAP['tcpPort']}}, drv.common.storage_info['portals']) + self.assertEqual(CONFIG_MAP['host_grp_name'], + drv.common.format_info['group_name_format'].format( + ip=DEFAULT_CONNECTOR['ip'])) self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(8, request.call_count) # stop the Loopingcall within the do_setup treatment diff --git a/cinder/volume/drivers/hitachi/hbsd_common.py b/cinder/volume/drivers/hitachi/hbsd_common.py index a6847a220fc..ec8170dc9a5 100644 --- a/cinder/volume/drivers/hitachi/hbsd_common.py +++ b/cinder/volume/drivers/hitachi/hbsd_common.py @@ -29,8 +29,6 @@ from cinder.volume.drivers.hitachi import hbsd_utils as utils from cinder.volume import volume_types from cinder.volume import volume_utils -_GROUP_NAME_FORMAT_DEFAULT_FC = utils.TARGET_PREFIX + '{wwn}' -_GROUP_NAME_FORMAT_DEFAULT_ISCSI = utils.TARGET_PREFIX + '{ip}' _GROUP_NAME_MAX_LEN_FC = 64 _GROUP_NAME_MAX_LEN_ISCSI = 32 @@ -147,27 +145,6 @@ COMMON_NAME_OPTS = [ help='Format of host groups, iSCSI targets, and server objects.'), ] -_GROUP_NAME_FORMAT = { - 'FC': { - 'group_name_max_len': _GROUP_NAME_MAX_LEN_FC, - 'group_name_var_cnt': { - GROUP_NAME_VAR_WWN: [1], - GROUP_NAME_VAR_IP: [0], - GROUP_NAME_VAR_HOST: [0, 1], - }, - 'group_name_format_default': _GROUP_NAME_FORMAT_DEFAULT_FC, - }, - 'iSCSI': { - 'group_name_max_len': _GROUP_NAME_MAX_LEN_ISCSI, - 'group_name_var_cnt': { - GROUP_NAME_VAR_WWN: [0], - GROUP_NAME_VAR_IP: [1], - GROUP_NAME_VAR_HOST: [0, 1], - }, - 'group_name_format_default': _GROUP_NAME_FORMAT_DEFAULT_ISCSI, - } -} - CONF = cfg.CONF CONF.register_opts(COMMON_VOLUME_OPTS, group=configuration.SHARED_CONF_GROUP) CONF.register_opts(COMMON_PORT_OPTS, group=configuration.SHARED_CONF_GROUP) @@ -217,7 +194,28 @@ class HBSDCommon(): 'portals': {}, } self.storage_id = None - self.group_name_format = _GROUP_NAME_FORMAT[driverinfo['proto']] + if self.storage_info['protocol'] == 'FC': + self.group_name_format = { + 'group_name_max_len': _GROUP_NAME_MAX_LEN_FC, + 'group_name_var_cnt': { + GROUP_NAME_VAR_WWN: [1], + GROUP_NAME_VAR_IP: [0], + GROUP_NAME_VAR_HOST: [0, 1], + }, + 'group_name_format_default': self.driver_info[ + 'target_prefix'] + '{wwn}', + } + if self.storage_info['protocol'] == 'iSCSI': + self.group_name_format = { + 'group_name_max_len': _GROUP_NAME_MAX_LEN_ISCSI, + 'group_name_var_cnt': { + GROUP_NAME_VAR_WWN: [0], + GROUP_NAME_VAR_IP: [1], + GROUP_NAME_VAR_HOST: [0, 1], + }, + 'group_name_format_default': self.driver_info[ + 'target_prefix'] + '{ip}', + } self.format_info = { 'group_name_format': self.group_name_format[ 'group_name_format_default'], @@ -690,7 +688,8 @@ class HBSDCommon(): if self.conf.hitachi_group_name_format is not None: error_flag = False if re.match( - utils.TARGET_PREFIX + '(' + GROUP_NAME_VAR_WWN + '|' + + self.driver_info['target_prefix'] + '(' + + GROUP_NAME_VAR_WWN + '|' + GROUP_NAME_VAR_IP + '|' + GROUP_NAME_VAR_HOST + '|' + '[' + GROUP_NAME_ALLOWED_CHARS + '])+$', self.conf.hitachi_group_name_format) is None: @@ -717,7 +716,7 @@ class HBSDCommon(): MSG.INVALID_PARAMETER, param=self.driver_info['param_prefix'] + '_group_name_format') - raise self.raise_error(msg) + self.raise_error(msg) self.format_info['group_name_format'] = ( self.conf.hitachi_group_name_format) self.format_info['group_name_format_without_var_len'] = ( diff --git a/releasenotes/notes/hitachi-vsp-fix-to-use-correct-HGname-78c3c47dcf984ddf.yaml b/releasenotes/notes/hitachi-vsp-fix-to-use-correct-HGname-78c3c47dcf984ddf.yaml new file mode 100644 index 00000000000..f865dc560a9 --- /dev/null +++ b/releasenotes/notes/hitachi-vsp-fix-to-use-correct-HGname-78c3c47dcf984ddf.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + HPE XP and NEC V driver `bug #2012515 + `_: Fixed to use + correct Host group name.