Merge "[SVf]: mkhost failure when volume and node are on different iogrp"

This commit is contained in:
Zuul 2022-12-27 10:58:26 +00:00 committed by Gerrit Code Review
commit d55a004e52
3 changed files with 75 additions and 6 deletions

View File

@ -4994,6 +4994,66 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
# Finally, check with good parameters
self.driver.do_setup(None)
@mock.patch.object(storwize_svc_common.StorwizeSSH,
'lsip')
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_node_info')
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_system_info')
def test_storwize_add_iscsi_ip_address(self, get_system_info,
get_node_info, lsip):
helper = self.driver._master_backend_helpers
helper.state = {'storage_nodes': {}, 'enabled_protocols': set(),
'compression_enabled': False, 'available_iogrps': [],
'system_name': None, 'system_id': None,
'code_level': None}
get_system_info.return_value = {'code_level': (8, 5, 0, 0),
'topology': 'standard',
'system_name': 'storwize-svc-sim',
'system_id': '0123456789ABCDEF'}
get_node_info.return_value = {'1': {'id': '1', 'name': 'node1',
'IO_group': 0,
'iscsi_name': 'test_iscsi1',
'site_id': '1',
'site_name': 'site1',
'ipv4': [],
'ipv6': [],
'IP_address': [],
'WWPN': [],
'enabled_protocols': [],
'status': 'online'},
'2': {'id': '2', 'name': 'node2',
'IO_group': 1,
'iscsi_name': 'test_iscsi2',
'site_id': '1',
'site_name': 'site1',
'ipv4': [],
'ipv6': [],
'IP_address': [],
'WWPN': [],
'enabled_protocols': [],
'status': 'online'}}
lsip.return_value = [{'node_id': '1', 'IP_address': '1.1.1.1'},
{'node_id': '2', 'IP_address': '2.2.2.2'}]
# Initially the storage_nodes will be empty
self.assertEqual(helper.state["storage_nodes"], {})
# _update_storwize_state will update the code_level
# and node info. After that it will call add_iscsi_ip_addrs to
# update the IP_address for the corresponding node_id in storage_nodes
self.driver._update_storwize_state(helper.state, helper)
# Now, IPs of both the node_id in storage_nodes is updated correctly
# Which means add_iscsi_ip_addrs was successful.
self.assertNotEqual(helper.state["storage_nodes"], {})
self.assertEqual(helper.state["storage_nodes"]['1']['IP_address'],
['1.1.1.1'])
self.assertEqual(helper.state["storage_nodes"]['2']['IP_address'],
['2.2.2.2'])
@mock.patch.object(storwize_svc_common.StorwizeSSH,
'mkhost')
def test_storwize_create_host_with_portset(self, mkhost):

View File

@ -1105,18 +1105,19 @@ class StorwizeHelpers(object):
if code_level >= (8, 4, 2, 0):
portset_name = portset if portset else 'portset0'
lsip_resp = self.ssh.lsip(portset=portset_name)
# For every node_id there is one IP address in a particular
# portset_name. Hence storing that one IP address of the
# corresponding node_id in storage_node list.
for node_data in storage_nodes:
ip_addresses = []
try:
for ip_data in lsip_resp:
if ip_data['node_id'] in node_data:
if (ip_data['IP_address']):
ip_addresses.append(ip_data['IP_address'])
if ip_data['IP_address']:
(storage_nodes[ip_data['node_id']]
['IP_address']) = (
[ip_data['IP_address']])
except KeyError:
self.handle_keyerror('lsip', ip_data)
if ip_addresses:
storage_nodes[ip_data['node_id']]['IP_address'] = (
ip_addresses)
else:
lsportip_resp = self.ssh.lsportip()
for ip_data in lsportip_resp:

View File

@ -0,0 +1,8 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver: `Bug #1985065
<https://bugs.launchpad.net/cinder/+bug/1985065>`_:
Fixed to collect all the IP addresses for all the storage
nodes given in lsip command response as volume of any iogrp
should be available to the storage nodes in default scenario.