From 0103c3aa9254f679d29ca8b7f6615f5646b0f029 Mon Sep 17 00:00:00 2001 From: Yong Huang Date: Wed, 25 Sep 2019 20:36:28 -0400 Subject: [PATCH] [Unity]: Failed to delete cifs share if wrong access set If wrong access was set, CIFS share won't be able to delete. Change-Id: Ie1c47dcbd53f7f49d9a8669e9912bb88abd6ac30 Closes-bug: #1845452 --- manila/share/drivers/dell_emc/plugins/unity/client.py | 6 +++++- manila/share/drivers/dell_emc/plugins/unity/connection.py | 3 ++- .../drivers/dell_emc/plugins/unity/fake_exceptions.py | 4 ++++ .../share/drivers/dell_emc/plugins/unity/test_client.py | 7 +++++++ ...ty--fix-fail-to-delete-cifs-share-c502a10ae306e506.yaml | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1845452-unity--fix-fail-to-delete-cifs-share-c502a10ae306e506.yaml diff --git a/manila/share/drivers/dell_emc/plugins/unity/client.py b/manila/share/drivers/dell_emc/plugins/unity/client.py index b75ccca865..9a26e38183 100644 --- a/manila/share/drivers/dell_emc/plugins/unity/client.py +++ b/manila/share/drivers/dell_emc/plugins/unity/client.py @@ -275,7 +275,11 @@ class UnityClient(object): def cifs_deny_access(self, share_name, user_name): share = self.system.get_cifs_share(name=share_name) - share.delete_ace(user=user_name) + try: + share.delete_ace(user=user_name) + except storops_ex.UnityAclUserNotFoundError: + LOG.debug('ACL User "%(user)s" does not exist.', + {'user': user_name}) def nfs_deny_access(self, share_name, host_ip): share = self.system.get_nfs_share(name=share_name) diff --git a/manila/share/drivers/dell_emc/plugins/unity/connection.py b/manila/share/drivers/dell_emc/plugins/unity/connection.py index 577d960ee6..9775ece73e 100644 --- a/manila/share/drivers/dell_emc/plugins/unity/connection.py +++ b/manila/share/drivers/dell_emc/plugins/unity/connection.py @@ -40,9 +40,10 @@ from manila import utils """Version history: 7.0.0 - Supports DHSS=False mode 7.0.1 - Fix parsing management IPv6 address + 7.0.2 - Bugfix: failed to delete CIFS share if wrong access was set """ -VERSION = "7.0.1" +VERSION = "7.0.2" LOG = log.getLogger(__name__) SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan') diff --git a/manila/tests/share/drivers/dell_emc/plugins/unity/fake_exceptions.py b/manila/tests/share/drivers/dell_emc/plugins/unity/fake_exceptions.py index 330bc97768..c8f818e588 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/unity/fake_exceptions.py +++ b/manila/tests/share/drivers/dell_emc/plugins/unity/fake_exceptions.py @@ -88,3 +88,7 @@ class SystemAPINotSupported(UnityException): class UnityVLANAlreadyHasInterfaceError(UnityException): pass + + +class UnityAclUserNotFoundError(UnityException): + pass diff --git a/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py b/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py index 386770c732..f8fc90eeda 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py +++ b/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py @@ -160,6 +160,13 @@ class TestClient(test.TestCase): client.delete_snapshot(snapshot) + @res_mock.patch_client + def test_cifs_deny_access__nonexistentuser_expt(self, client): + try: + client.cifs_deny_access('fake_share_name', 'fake_username') + except fake_exceptions.UnityAclUserNotFoundError: + self.fail("UnityAclUserNotFoundError raised unexpectedly!") + @res_mock.patch_client def test_nfs_deny_access__nonexistent_expt(self, client): client.nfs_deny_access('fake_share_name', 'fake_ip_addr') diff --git a/releasenotes/notes/bug-1845452-unity--fix-fail-to-delete-cifs-share-c502a10ae306e506.yaml b/releasenotes/notes/bug-1845452-unity--fix-fail-to-delete-cifs-share-c502a10ae306e506.yaml new file mode 100644 index 0000000000..7873f5d063 --- /dev/null +++ b/releasenotes/notes/bug-1845452-unity--fix-fail-to-delete-cifs-share-c502a10ae306e506.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Fixed an issue with Unity driver fails to delete CIFS share if wrong + access was set.