Skip to content

Commit

Permalink
CA-207781: NFS SR probe should use one of the supported versions
Browse files Browse the repository at this point in the history
SR probe for NFS SRs always mounts the temporary share with
version= 3(default version). If this is not supported by the server,
sr-probe doesn't return any results. Fixed by mounting share with any
one of the valid versions supported by the server.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
  • Loading branch information
chandrikas committed Apr 19, 2016
1 parent dd3e818 commit 3974795
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/NFSSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def validate_remotepath(self, scan):
def check_server(self):
try:
if self.dconf.has_key(PROBEVERSION):
nfs.check_server_tcp(self.remoteserver)
sv = nfs.get_supported_nfs_versions(self.remoteserver)
if len(sv):
self.nfsversion = sv[0]
else:
nfs.check_server_tcp(self.remoteserver, self.nfsversion)
except nfs.NfsException, exc:
Expand All @@ -119,12 +121,7 @@ def check_server(self):

def mount(self, mountpoint, remotepath, timeout = 0):
try:
if self.dconf.has_key(PROBEVERSION):
nfs.soft_mount(
mountpoint, self.remoteserver, remotepath, self.transport,
timeout=timeout)
else:
nfs.soft_mount(
nfs.soft_mount(
mountpoint, self.remoteserver, remotepath, self.transport,
timeout=timeout, nfsversion=self.nfsversion)
except nfs.NfsException, exc:
Expand All @@ -142,6 +139,10 @@ def attach(self, sr_uuid):

def mount_remotepath(self, sr_uuid, timeout = 0):
if not self._checkmount():
# FIXME: What is the purpose of this check_server?
# It doesn't stop us from continuing if the server
# doesn't support the requested version. We fail
# in mount instead
self.check_server()
self.mount(self.path, self.remotepath, timeout)

Expand Down

0 comments on commit 3974795

Please sign in to comment.