Dominik Holler has uploaded a new change for review.

Change subject: storage: iscsiadm parses IPv6 iSCSI addresses
......................................................................

storage: iscsiadm parses IPv6 iSCSI addresses

Enables parsing of IPv6 iSCSI addresses during discovery.

Change-Id: I0e9fa8d8f5ac34753ad6d40625e64dfeee1a3c02
Bug-Url: https://bugzilla.redhat.com/1308306
Signed-off-by: Dominik Holler <[email protected]>
---
M vdsm/storage/iscsiadm.py
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/65707/5

diff --git a/vdsm/storage/iscsiadm.py b/vdsm/storage/iscsiadm.py
index 52a0083..2cfe6c5 100644
--- a/vdsm/storage/iscsiadm.py
+++ b/vdsm/storage/iscsiadm.py
@@ -31,6 +31,7 @@
 ISCSI_ERR_SESS_EXISTS = 15
 ISCSI_ERR_LOGIN_AUTH_FAILED = 24
 ISCSI_ERR_OBJECT_NOT_FOUND = 21
+ISCSI_HOST_IPV6_REGEX = re.compile(r"\[(.*)\]:([0-9]+)")
 
 Iface = namedtuple('Iface', 'ifacename transport_name hwaddress ipaddress \
                     net_ifacename initiatorname')
@@ -239,11 +240,16 @@
     if rc == 0:
         res = []
         for line in out:
-            if line.startswith("["):  # skip IPv6 targets
-                continue
             rest, iqn = line.split()
             rest, tpgt = rest.split(",")
-            ip, port = rest.split(":")
+            if rest.startswith("["):
+                # IPv6
+                match = ISCSI_HOST_IPV6_REGEX.match(rest)
+                ip = match.group(1)
+                port = match.group(2)
+            else:
+                # IPv4
+                ip, port = rest.split(":")
             res.append((ip, int(port), int(tpgt), iqn))
 
         return res


-- 
To view, visit https://gerrit.ovirt.org/65707
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e9fa8d8f5ac34753ad6d40625e64dfeee1a3c02
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dominik Holler <[email protected]>
_______________________________________________
vdsm-patches mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to