Skip to content

Commit

Permalink
Multipath is a boolean, not a string
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Bischoff <[email protected]>
  • Loading branch information
Bischoff committed Dec 31, 2023
1 parent c916217 commit b8d7813
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
42 changes: 20 additions & 22 deletions zvmsdk/tests/unit/test_volumeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2103,7 +2103,7 @@ def test_attach(self, mock_dedicate, mock_add_disk, mock_fcp_info, mock_check):
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2166,7 +2166,7 @@ def test_attach_with_exception(self, mock_do_attach, mock_check_userid,
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182'],
'target_lun': '2222',
'zvm_fcp': ['E83C', 'D83C'],
Expand Down Expand Up @@ -2194,7 +2194,7 @@ def test_attach_with_root_volume(self, mock_dedicate, mock_add_disk,
connection_info = {'platform': 's390x',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2258,7 +2258,7 @@ def test_attach_no_dedicate(self, mock_check_userid, mock_dedicate,
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2313,7 +2313,7 @@ def test_attach_with_do_rollback(self, mock_check_userid, mock_do_attach):
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076d8500005182',
'20076d8500005183'],
'target_lun': '2222',
Expand All @@ -2323,14 +2323,13 @@ def test_attach_with_do_rollback(self, mock_check_userid, mock_do_attach):
'fcp_template_id': 'tmpl_id',
'is_root_volume': False}
mock_check_userid.return_value = True
multipath = True
# case1: do_rollback as False
connection_info['do_rollback'] = False
self.volumeops.attach(connection_info)
mock_do_attach.assert_called_once_with(
connection_info['zvm_fcp'], connection_info['assigner_id'].upper(),
connection_info['target_wwpn'], connection_info['target_lun'],
multipath, connection_info['os_version'],
connection_info['multipath'], connection_info['os_version'],
connection_info['mount_point'], connection_info['is_root_volume'],
connection_info['fcp_template_id'], do_rollback=False
)
Expand All @@ -2341,7 +2340,7 @@ def test_attach_with_do_rollback(self, mock_check_userid, mock_do_attach):
mock_do_attach.assert_called_once_with(
connection_info['zvm_fcp'], connection_info['assigner_id'].upper(),
connection_info['target_wwpn'], connection_info['target_lun'],
multipath, connection_info['os_version'],
connection_info['multipath'], connection_info['os_version'],
connection_info['mount_point'], connection_info['is_root_volume'],
connection_info['fcp_template_id'], do_rollback=True
)
Expand All @@ -2357,7 +2356,7 @@ def test_do_attach_with_rollback_due_to_increase_fcp_connections_failure(
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2401,7 +2400,7 @@ def test_do_attach_with_rollback_due_to_dedicate_fcp_failure(self, mock_increase
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2462,7 +2461,7 @@ def test_do_attach_with_rollback_due_to_add_disks_failure(self, mock_increase_co
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2524,7 +2523,7 @@ def test_do_attach_with_do_rollback(self, mock_reserve_fcp, mock_increase_conn,
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2588,7 +2587,7 @@ def test_do_detach_with_rollback_due_to_remove_disks_failure(self, mock_remove_d
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'false',
'multipath': False,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2650,7 +2649,7 @@ def test_do_detach_with_rollback_due_to_undedicate_failure(self, mock_remove_dis
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'False',
'multipath': False,
'target_wwpn': ['20076D8500005181',
'20076D8500005182'],
'target_lun': '2222',
Expand Down Expand Up @@ -2723,7 +2722,7 @@ def test_do_detach_with_do_rollback(self, mock_decrease_conn, mock_undedicate_fc
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2784,7 +2783,7 @@ def test_detach_with_do_rollback(self, mock_do_detach):
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076d8500005182',
'20076d8500005183'],
'target_lun': '2222',
Expand All @@ -2795,12 +2794,11 @@ def test_detach_with_do_rollback(self, mock_do_detach):
connection_info['do_rollback'] = False
connection_info['is_root_volume'] = False
connection_info['update_connections_only'] = False
multipath = True
self.volumeops.detach(connection_info)
mock_do_detach.assert_called_once_with(
connection_info['zvm_fcp'], connection_info['assigner_id'].upper(),
connection_info['target_wwpn'], connection_info['target_lun'],
multipath, connection_info['os_version'],
connection_info['multipath'], connection_info['os_version'],
connection_info['mount_point'], connection_info['is_root_volume'],
connection_info['update_connections_only'], do_rollback=False
)
Expand All @@ -2811,7 +2809,7 @@ def test_detach_with_do_rollback(self, mock_do_detach):
mock_do_detach.assert_called_once_with(
connection_info['zvm_fcp'], connection_info['assigner_id'].upper(),
connection_info['target_wwpn'], connection_info['target_lun'],
multipath, connection_info['os_version'],
connection_info['multipath'], connection_info['os_version'],
connection_info['mount_point'], connection_info['is_root_volume'],
connection_info['update_connections_only'], do_rollback=True
)
Expand All @@ -2827,7 +2825,7 @@ def test_root_volume_detach(self, mock_undedicate, mock_remove_disk,
connection_info = {'platform': 's390x',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2878,7 +2876,7 @@ def test_update_connections_only_detach(self, mock_undedicate,
connection_info = {'platform': 's390x',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'True',
'multipath': True,
'target_wwpn': ['20076D8500005182',
'20076D8500005183'],
'target_lun': '2222',
Expand Down Expand Up @@ -2928,7 +2926,7 @@ def test_detach_no_undedicate(self, mock_undedicate, mock_remove_disk,
connection_info = {'platform': 'x86_64',
'ip': '1.2.3.4',
'os_version': 'rhel7',
'multipath': 'False',
'multipath': False,
'target_wwpn': ['1111'],
'target_lun': '2222',
'zvm_fcp': ['283c'],
Expand Down
6 changes: 1 addition & 5 deletions zvmsdk/volumeop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,11 +2307,7 @@ def attach(self, connection_info):
wwpns = connection_info['target_wwpn']
target_lun = connection_info['target_lun']
assigner_id = connection_info['assigner_id'].upper()
multipath = connection_info['multipath'].lower()
if multipath == 'true':
multipath = True
else:
multipath = False
multipath = connection_info.get('multipath', False)
os_version = connection_info['os_version']
mount_point = connection_info['mount_point']
is_root_volume = connection_info.get('is_root_volume', False)
Expand Down

0 comments on commit b8d7813

Please sign in to comment.