diff --git a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py index 0f40dd6b324..1c0d398e947 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py @@ -596,6 +596,19 @@ class FCAdapterTest(unittest.TestCase): target_wwn = ['100000051e55a100', '100000051e55a121'] self.assertListEqual(target_wwn, data['target_wwn']) + def test_terminate_connection_auto_zone_enabled_none_host_luns(self): + connector = {'host': 'host-no-host_luns', 'wwpns': 'abcdefg'} + volume = MockOSResource(provider_location='id^lun_41', id='id_41') + ret = self.adapter.terminate_connection(volume, connector) + self.assertEqual('fibre_channel', ret['driver_volume_type']) + data = ret['data'] + target_map = { + '200000051e55a100': ('100000051e55a100', '100000051e55a121'), + '200000051e55a121': ('100000051e55a100', '100000051e55a121')} + self.assertDictEqual(target_map, data['initiator_target_map']) + target_wwn = ['100000051e55a100', '100000051e55a121'] + self.assertListEqual(target_wwn, data['target_wwn']) + def test_validate_ports_whitelist_none(self): ports = self.adapter.validate_ports(None) self.assertEqual(set(('spa_iom_0_fc0', 'spa_iom_0_fc1')), set(ports)) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_client.py b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_client.py index 9f937014088..d689904051b 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_client.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_client.py @@ -161,6 +161,8 @@ class MockResource(object): @property def host_luns(self): + if self.name == 'host-no-host_luns': + return None return [] @property diff --git a/cinder/volume/drivers/dell_emc/unity/adapter.py b/cinder/volume/drivers/dell_emc/unity/adapter.py index 09d8105caaf..3865b5a6476 100644 --- a/cinder/volume/drivers/dell_emc/unity/adapter.py +++ b/cinder/volume/drivers/dell_emc/unity/adapter.py @@ -599,7 +599,7 @@ class FCAdapter(CommonAdapter): 'data': {} } host = self.client.create_host(connector['host']) - if len(host.host_luns) == 0: + if not host.host_luns: targets = self.client.get_fc_target_info( logged_in_only=True, allowed_ports=self.allowed_ports) ret['data'] = self._get_fc_zone_info(connector['wwpns'], diff --git a/cinder/volume/drivers/dell_emc/unity/driver.py b/cinder/volume/drivers/dell_emc/unity/driver.py index 4102c5eedf4..c65ac04ef65 100644 --- a/cinder/volume/drivers/dell_emc/unity/driver.py +++ b/cinder/volume/drivers/dell_emc/unity/driver.py @@ -48,6 +48,9 @@ class UnityDriver(driver.ManageableVD, """Unity Driver. Version history: + + .. code-block:: none + 1.0.0 - Initial version (Ocata) 1.0.1 - Fixed bug 170311: temp snapshot for backup was deleted twice 1.0.2 - Fixes bug 1775518 to make sure driver succeed to initialize @@ -55,9 +58,11 @@ class UnityDriver(driver.ManageableVD, unity_storage_pool_names are empty 1.0.3 - Fixed bug 1741831: corrected support to force detach a volume from all its attached hosts. + 1.0.4 - Fixes bug 1759175 to detach the lun correctly when auto zone + was enabled and the lun was the last one attached to the host. """ - VERSION = '01.00.03' + VERSION = '01.00.04' VENDOR = 'Dell EMC' # ThirdPartySystems wiki page CI_WIKI_NAME = "EMC_UNITY_CI" diff --git a/releasenotes/notes/fail-detach-lun-when-auto-zone-enabled-9c87b18a3acac9d1.yaml b/releasenotes/notes/fail-detach-lun-when-auto-zone-enabled-9c87b18a3acac9d1.yaml new file mode 100644 index 00000000000..be3b59cb7f4 --- /dev/null +++ b/releasenotes/notes/fail-detach-lun-when-auto-zone-enabled-9c87b18a3acac9d1.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Dell EMC Unity Driver: Fixes `bug 1759175 + `__ + to detach the lun correctly when auto zone was enabled and the lun was the + last one attached to the host.