[Unity]: Failed to delete cifs share if wrong access set

If wrong access was set, CIFS share won't be able to delete.

Depends-On: I624e1dc57a3d3533322fb298c01f70241d0400ed
Change-Id: Ie1c47dcbd53f7f49d9a8669e9912bb88abd6ac30
Closes-bug: #1845452
(cherry picked from commit 0103c3aa92)
(cherry picked from commit b3d6254e35)
(cherry picked from commit d1c42a02a9)
This commit is contained in:
Yong Huang 2019-09-25 20:36:28 -04:00
parent 8be8c8d6a4
commit 6c3bd6600b
5 changed files with 23 additions and 2 deletions

View File

@ -274,7 +274,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)

View File

@ -36,11 +36,13 @@ from manila.share.drivers.dell_emc.plugins.unity import utils as unity_utils
from manila.share import utils as share_utils
from manila import utils
VERSION = "4.0.1"
"""Version history:
4.0.1 - Fix parsing management IPv6 address
5.0.1 - Bugfix: failed to delete CIFS share if wrong access was set
"""
VERSION = "5.0.1"
LOG = log.getLogger(__name__)
SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan')

View File

@ -84,3 +84,7 @@ class SystemAPINotSupported(UnityException):
class UnityVLANAlreadyHasInterfaceError(UnityException):
pass
class UnityAclUserNotFoundError(UnityException):
pass

View File

@ -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')

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed an issue with Unity driver fails to delete CIFS share if wrong
access was set.