Skip to content

Commit

Permalink
NFS 4.1 Support
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Juhl <m@rtinjuhl.dk>
  • Loading branch information
MrMEEE authored and MarkSymsCtx committed Jan 30, 2019
1 parent 41b6a0e commit 46a8c7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions drivers/nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
DEFAULT_NFSVERSION = '3'

NFS_VERSION = [
'nfsversion', 'for type=nfs, NFS protocol version - 3, 4']
'nfsversion', 'for type=nfs, NFS protocol version - 3, 4, 4.1']

NFS_SERVICE_WAIT = 30
NFS_SERVICE_RETRY = 6
Expand Down Expand Up @@ -111,7 +111,7 @@ def validate_nfsversion(nfsversion):
if not nfsversion:
nfsversion = DEFAULT_NFSVERSION
else:
if nfsversion not in ['3', '4']:
if nfsversion not in ['3', '4', '4.1']:
raise NfsException("Invalid nfsversion.")
return nfsversion

Expand Down Expand Up @@ -143,6 +143,9 @@ def soft_mount(mountpoint, remoteserver, remotepath, transport, useroptions='',
mountcommand = 'mount.nfs'
if nfsversion == '4':
mountcommand = 'mount.nfs4'

if nfsversion == '4.1':
mountcommand = 'mount.nfs4'

options = "soft,proto=%s,vers=%s" % (
transport,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_validate_nfsversion_invalid(self):
thenfsversion)

def test_validate_nfsversion_unsupported(self):
for thenfsversion in ['2', '4.1']:
for thenfsversion in ['2']:
self.assertRaises(nfs.NfsException, nfs.validate_nfsversion,
thenfsversion)

Expand All @@ -128,6 +128,6 @@ def test_validate_nfsversion_default(self):
self.assertEquals(nfs.validate_nfsversion(thenfsversion), '3')

def test_validate_nfsversion_valid(self):
for thenfsversion in ['3', '4']:
for thenfsversion in ['3', '4', '4.1']:
self.assertEquals(nfs.validate_nfsversion(thenfsversion),
thenfsversion)

0 comments on commit 46a8c7a

Please sign in to comment.