Skip to content

Commit

Permalink
Allow disabling NFSv4.0
Browse files Browse the repository at this point in the history
NFS v4.0 was previously handled differently in NetApp driver.
We want to explicitly disable v4.0 if it is not set in 'netapp_enabled_share_protocols'.

Also enable v4.1 options like read/write delegation, pnfs, acls.
  • Loading branch information
galkindmitrii authored and chuan137 committed Aug 22, 2022
1 parent b604de1 commit 0215f0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions manila/share/drivers/netapp/dataontap/client/client_cmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,10 +1549,12 @@ def enable_nfs(self, versions, nfs_config=None):
def _enable_nfs_protocols(self, versions):
"""Set the enabled NFS protocol versions."""
nfs3 = 'true' if 'nfs3' in versions else 'false'
nfs40 = 'true' if 'nfs4.0' in versions else 'false'
nfs41 = 'true' if 'nfs4.1' in versions else 'false'

nfs_service_modify_args = {
'is-nfsv3-enabled': nfs3,
'is-nfsv40-enabled': nfs40,
'is-nfsv41-enabled': nfs41,
'showmount': 'true',
'is-v3-ms-dos-client-enabled': 'true',
Expand All @@ -1561,8 +1563,15 @@ def _enable_nfs_protocols(self, versions):
'is-vstorage-enabled': 'true',
}

if 'nfs4.0' in versions:
nfs_service_modify_args['is-nfsv40-enabled'] = 'true'
if 'nfs4.1' in versions:
nfs41_opts = {
'is-nfsv41-pnfs-enabled': 'true',
'is-nfsv41-acl-enabled': 'true',
'is-nfsv41-read-delegation-enabled': 'true',
'is-nfsv41-write-delegation-enabled': 'true',
}

nfs_service_modify_args.update(nfs41_opts)

self.send_request('nfs-service-modify', nfs_service_modify_args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2505,15 +2505,24 @@ def test_enable_nfs_protocols(self, v3, v40, v41):

nfs_service_modify_args = {
'is-nfsv3-enabled': 'true' if v3 else 'false',
'is-nfsv40-enabled': 'true' if v40 else 'false',
'is-nfsv41-enabled': 'true' if v41 else 'false',
'showmount': 'true',
'is-v3-ms-dos-client-enabled': 'true',
'is-nfsv3-connection-drop-enabled': 'false',
'enable-ejukebox': 'false',
'is-vstorage-enabled': 'true',
}
if v40:
nfs_service_modify_args['is-nfsv40-enabled'] = 'true'

if v41:
nfs41_opts = {
'is-nfsv41-pnfs-enabled': 'true',
'is-nfsv41-acl-enabled': 'true',
'is-nfsv41-read-delegation-enabled': 'true',
'is-nfsv41-write-delegation-enabled': 'true',
}

nfs_service_modify_args.update(nfs41_opts)

self.client.send_request.assert_called_once_with(
'nfs-service-modify', nfs_service_modify_args)
Expand Down

0 comments on commit 0215f0f

Please sign in to comment.