From dcfc2f3d5ac69e0fd0c6ecbdd6ce26ed1cecd96c Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 25 Feb 2019 17:43:46 +0800 Subject: [PATCH] VNX: update sg in cache When `destroy_empty_storage_group` is enabled, the sg will be deleted after the last lun is detached from it. The issue is that the sg cache isn't updated, which caused the failure of subsequent attaching volumes to the same host because the sg in the cache will be used directly which doesn't exist any more. The fix is updating the sg with poll after deleting it. This doesn't delete the sg from cache explicitly but makes sure the sg in cache with latest status `not-exist`. Subsequent attaching will create the sg if it is `not-exist`. Closes-bug: #1817385 Change-Id: Ibb39879a77c97c6a5d885461e93116810d16b265 (cherry picked from commit eefd8302b3a01fd5cff0169b6eca0588975ff244) (cherry picked from commit 1f57f502c893a840ee5021fbca36ae95eed50e73) (cherry picked from commit 29d42fa73448b3d23d9da4db7b2f407694681ece) --- .../tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml | 4 ++++ cinder/volume/drivers/dell_emc/vnx/adapter.py | 5 +++++ cinder/volume/drivers/dell_emc/vnx/driver.py | 7 +++++-- .../notes/vnx-update-sg-in-cache-3ecb673727bea79b.yaml | 7 +++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/vnx-update-sg-in-cache-3ecb673727bea79b.yaml diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml index 7b9410adbab..3fdbac63ba8 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml +++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml @@ -2047,6 +2047,8 @@ test_terminate_connection_cleanup_remove_sg: delete: disconnect_host: get_alu_hlu_map: {} + update: + with_poll: _context test_terminate_connection_cleanup_sg_absent: sg: @@ -2060,6 +2062,8 @@ test_terminate_connection_cleanup_deregister: delete: disconnect_host: get_alu_hlu_map: {} + update: + with_poll: _context vnx: _methods: delete_hba: diff --git a/cinder/volume/drivers/dell_emc/vnx/adapter.py b/cinder/volume/drivers/dell_emc/vnx/adapter.py index 8b6ce6f7f46..fa8e78890e8 100644 --- a/cinder/volume/drivers/dell_emc/vnx/adapter.py +++ b/cinder/volume/drivers/dell_emc/vnx/adapter.py @@ -1079,6 +1079,11 @@ class CommonAdapter(replication.ReplicationAdapter): LOG.info("Storage Group %s is empty.", sg.name) sg.disconnect_host(sg.name) sg.delete() + + # Update sg with poll makes the one in client.sg_cache is with + # latest status which is un-exist. This makes sure the sg is + # created during next attaching. + self.update_storage_group_if_required(sg) if host is not None and self.itor_auto_dereg: # `host` is None when force-detach self._deregister_initiator(host) diff --git a/cinder/volume/drivers/dell_emc/vnx/driver.py b/cinder/volume/drivers/dell_emc/vnx/driver.py index 9c4d02bf8cc..7d1ee31a8b5 100644 --- a/cinder/volume/drivers/dell_emc/vnx/driver.py +++ b/cinder/volume/drivers/dell_emc/vnx/driver.py @@ -76,10 +76,13 @@ class VNXDriver(driver.ManageableVD, image cache volume 10.1.0 - Add QoS support 10.2.0 - Add replication group support - 11.0.0 - Fix failure of migration during cloning + 10.2.1 - Fix failure of migration during cloning + 10.2.2 - Fix bug https://bugs.launchpad.net/cinder/+bug/1817385 to + make sure sg can be created again after it was destroyed + under `destroy_empty_stroage_group` setting to `True` """ - VERSION = '11.00.00' + VERSION = '10.02.02' VENDOR = 'Dell EMC' # ThirdPartySystems wiki page CI_WIKI_NAME = "EMC_VNX_CI" diff --git a/releasenotes/notes/vnx-update-sg-in-cache-3ecb673727bea79b.yaml b/releasenotes/notes/vnx-update-sg-in-cache-3ecb673727bea79b.yaml new file mode 100644 index 00000000000..35256a9b8bc --- /dev/null +++ b/releasenotes/notes/vnx-update-sg-in-cache-3ecb673727bea79b.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Dell EMC VNX Driver: Fixes `bug 1817385 + `__ to make sure the sg can + be created again after it was destroyed under `destroy_empty_storage_group` + setting to `True`.