Merge "HPE XP and NEC V: Host group name is not correct"

This commit is contained in:
Zuul 2023-11-21 20:06:46 +00:00 committed by Gerrit Code Review
commit b8f087d2fa
4 changed files with 36 additions and 25 deletions

View File

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

View File

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

View File

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

View File

@ -0,0 +1,6 @@
---
fixes:
- |
HPE XP and NEC V driver `bug #2012515
<https://bugs.launchpad.net/cinder/+bug/2012515>`_: Fixed to use
correct Host group name.