Merge "Cannot remove user rule for NFS share"

This commit is contained in:
Zuul 2018-06-22 18:08:21 +00:00 committed by Gerrit Code Review
commit aee5bfe65a
3 changed files with 15 additions and 2 deletions

View File

@ -263,8 +263,6 @@ class NFSHelper(NASHelperBase):
(const.ACCESS_LEVEL_RO, const.ACCESS_LEVEL_RW))
for access in delete_rules:
access_to = self._get_parsed_address_or_cidr(
access['access_to'])
try:
self.validate_access_rules(
[access], ('ip',),
@ -278,6 +276,8 @@ class NFSHelper(NASHelperBase):
'type': access['access_type'],
'to': access['access_to']})
continue
access_to = self._get_parsed_address_or_cidr(
access['access_to'])
self._ssh_exec(server, ['sudo', 'exportfs', '-u',
':'.join((access_to, local_path))])
if delete_rules:

View File

@ -215,6 +215,15 @@ class NFSHelperTestCase(test.TestCase):
[],
[])
def test_update_access_delete_invalid_rule(self):
delete_rules = [test_generic.get_fake_access_rule(
'lala', 'fake_level', access_type='user'), ]
self.mock_object(self._helper, '_sync_nfs_temp_and_perm_files')
self._helper.update_access(self.server, self.share_name, [],
[], delete_rules)
self._helper._sync_nfs_temp_and_perm_files.assert_called_with(
self.server)
def test_get_host_list(self):
fake_exportfs = ('/shares/share-1\n\t\t20.0.0.3\n'
'/shares/share-1\n\t\t20.0.0.6\n'

View File

@ -0,0 +1,4 @@
---
fixes:
- The generic driver has been fixed to allow removing
inappropriate CIFS rules on NFS shares.