From e67368ce03d3bda7b20fb173901ab99b068c1566 Mon Sep 17 00:00:00 2001 From: BenjiReis Date: Mon, 25 Sep 2023 16:00:33 +0200 Subject: [PATCH] Support IPv6 for NFS ISO SR Location are of form: `[]:/path` Signed-off-by: BenjiReis --- drivers/ISOSR.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/ISOSR.py b/drivers/ISOSR.py index d7f836e13..fdb72521c 100755 --- a/drivers/ISOSR.py +++ b/drivers/ISOSR.py @@ -326,13 +326,22 @@ def attach(self, sr_uuid): # For NFS, do a soft mount with tcp as protocol. Since ISO SR is # going to be r-only, a failure in nfs link can be reported back # to the process waiting. - serv_path = location.split(':') + serv_path = [] + transport = 'tcp' + if location.startswith('['): + # IPv6 target: remove brackets around the IPv6 + transport = 'tcp6' + ip6 = location[1:location.index(']')] + path = location[location.index(']') + 2:] + serv_path = [ip6, path] + else: + serv_path = location.split(':') util._testHost(serv_path[0], NFSPORT, 'NFSTarget') # Extract timeout and retrans values, if any io_timeout = nfs.get_nfs_timeout(self.other_config) io_retrans = nfs.get_nfs_retrans(self.other_config) nfs.soft_mount(self.mountpoint, serv_path[0], serv_path[1], - 'tcp', useroptions=options, nfsversion=self.nfsversion, + transport, useroptions=options, nfsversion=self.nfsversion, timeout=io_timeout, retrans=io_retrans) else: if self.smbversion in SMB_VERSION_3: