[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
This commit is contained in:
Yong Huang 2019-09-25 20:36:28 -04:00
parent 579487cabb
commit 0103c3aa92
5 changed files with 22 additions and 2 deletions

View File

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

View File

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

View File

@ -88,3 +88,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.