[PATCH] Don't mix target and discovery credentials (#1037564)

Anne Mulhern amulhern at redhat.com
Mon Sep 22 12:48:50 UTC 2014



----- Original Message -----
From: "Martin Kolman" <mkolman at redhat.com>
To: anaconda-patches at lists.fedorahosted.org
Sent: Monday, September 22, 2014 7:53:41 AM
Subject: [PATCH] Don't mix target and discovery credentials (#1037564)

The (optional) discovery credentials are different to the more commonly
seen ISCSI CHAP/reverse CHAP credentials and care needs to be taken to
not mix them together.

Resolves: rhbz#1037564
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 blivet/iscsi.py | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 1360c1b..4eec0f6 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -321,14 +321,44 @@ class iscsi(object):
 
         return (rc, msg)
 
-    # NOTE: the same credentials are used for discovery and login
-    #       (unlike in UI)
     def addTarget(self, ipaddr, port="3260", user=None, pw=None,
-                  user_in=None, pw_in=None, target=None, iface=None):
+                  user_in=None, pw_in=None, target=None, iface=None,
+                  discover_user=None, discover_pw=None,
+                  discover_user_in=None, discover_pw_in=None):
+        """
+        Add nodes from a iSCSI target
+        NOTE: the iSCSI target can have two sets of different authentication
+              credentials - one for discovery and one for logging into nodes
+
+        :param str ipaddr: target IP address
+        :param str port: target port
+        :param user: CHAP username for node login
+        :type user: str or NoneType
+        :param pw: CHAP password for node login
+        :type pw: str or NoneType
+        :param user_in: reverse CHAP username for node login
+        :type user: str or NoneType
+        :param pw_in: reverse CHAP password for node login
+        :type pw_in: str or NoneType
+        :param target: name of the target
+        :type target: str or NoneType
+        :param iface: interface to use
+        :type iface: str of NoneType

Tiny typo, "of" should be "or".

+        :param discover_user: CHAP username for discovery
+        :type discover_user: str or NoneType
+        :param discover_pw: CHAP password for discovery
+        :type discover_pw: str or NoneType
+        :param discover_user_in: reverse CHAP username for discovery
+        :type discover_user: str or NoneType
+        :param discover_pw_in: reverse CHAP password for discovery
+        :type discover_pw_in: str or NoneType
+        """
+
         found = 0
         logged_in = 0
 
-        found_nodes = self.discover(ipaddr, port, user, pw, user_in, pw_in)
+        found_nodes = self.discover(ipaddr, port, discover_user, discover_pw,
+                                    discover_user_in, discover_pw_in)
         if found_nodes == None:
             raise IOError(_("No iSCSI nodes discovered"))
 
-- 
1.9.3

_______________________________________________
anaconda-patches mailing list
anaconda-patches at lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches

Except for inline comment, looks good.

- mulhern


More information about the anaconda-patches mailing list