Merge "DS8K: correct behavior and return value for terminate_connection method"
This commit is contained in:
commit
4771f053ad
cinder
tests/unit/volume/drivers/ibm
volume/drivers/ibm/ibm_storage
@ -2707,11 +2707,8 @@ class DS8KProxyTest(test.TestCase):
|
||||
|
||||
map_data = self.driver.initialize_connection(volume, TEST_CONNECTOR)
|
||||
self.assertEqual(int(TEST_LUN_ID), map_data['data']['target_lun'])
|
||||
self.assertTrue(
|
||||
list(map_data['data']['initiator_target_map'].keys())[0] in
|
||||
[TEST_SOURCE_WWPN_1, TEST_SOURCE_WWPN_2])
|
||||
self.assertTrue(
|
||||
list(map_data['data']['initiator_target_map'].keys())[1] in
|
||||
self.assertEqual(sorted(list(
|
||||
map_data['data']['initiator_target_map'].keys()), key=str.lower),
|
||||
[TEST_SOURCE_WWPN_1, TEST_SOURCE_WWPN_2])
|
||||
|
||||
def test_initialize_connection_of_eckd_volume(self):
|
||||
@ -2876,9 +2873,7 @@ class DS8KProxyTest(test.TestCase):
|
||||
}
|
||||
]
|
||||
mock_get_host_ports.side_effect = [host_ports]
|
||||
self.assertRaises(exception.VolumeDriverException,
|
||||
self.driver.terminate_connection, volume,
|
||||
TEST_CONNECTOR)
|
||||
self.driver.terminate_connection(volume, TEST_CONNECTOR)
|
||||
|
||||
@mock.patch.object(helper.DS8KCommonHelper, '_get_host_ports')
|
||||
@mock.patch.object(helper.DS8KCommonHelper, '_get_mappings')
|
||||
@ -2918,7 +2913,10 @@ class DS8KProxyTest(test.TestCase):
|
||||
]
|
||||
mock_get_host_ports.side_effect = [host_ports]
|
||||
mock_get_mappings.side_effect = [mappings]
|
||||
self.driver.terminate_connection(volume, TEST_CONNECTOR)
|
||||
ret_info = self.driver.terminate_connection(volume, TEST_CONNECTOR)
|
||||
self.assertEqual(sorted(list(
|
||||
ret_info['data']['initiator_target_map'].keys()), key=str.lower),
|
||||
[TEST_SOURCE_WWPN_1, TEST_SOURCE_WWPN_2])
|
||||
|
||||
@mock.patch.object(helper.DS8KCommonHelper, '_get_host_ports')
|
||||
@mock.patch.object(helper.DS8KCommonHelper, '_get_mappings')
|
||||
|
@ -696,7 +696,7 @@ class DS8KCommonHelper(object):
|
||||
self._delete_host_ports(port)
|
||||
self._delete_host(host_id)
|
||||
target_ports = [p['wwpn'] for p in self._get_ioports()]
|
||||
target_map = {initiator.upper(): target_ports
|
||||
target_map = {initiator: target_ports
|
||||
for initiator in connector['wwpns']}
|
||||
ret_info['data']['initiator_target_map'] = target_map
|
||||
return ret_info
|
||||
|
@ -1080,9 +1080,8 @@ class DS8KProxy(proxy.IBMStorageProxy):
|
||||
backend_helper.check_vol_mapped_to_host(connector, lun.ds_id))
|
||||
if host_id is None or not vol_mapped:
|
||||
if host_id is None and not lun.type_replication:
|
||||
msg = (_('Failed to find the Host information.'))
|
||||
LOG.error(msg)
|
||||
raise exception.VolumeDriverException(message=msg)
|
||||
LOG.warning('Failed to find the Host information.')
|
||||
return ret_info
|
||||
if host_id and not lun.type_replication and not vol_mapped:
|
||||
LOG.warning("Volume %(vol)s is already not mapped to "
|
||||
"host %(host)s.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user