[PATCH rhel6-branch 6/7] iscsi: add interface binding support to kickstart (#500273)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves: rhbz#500273

All devices must be either bonded (using --iface option) or using
default.
---
 kickstart.py     |   24 ++++++++++++++++++++----
 storage/iscsi.py |   10 +++++++++-
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index de2dbe9..2c52854 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -415,16 +415,32 @@ class IgnoreDisk(commands.ignoredisk.RHEL6_IgnoreDisk):
         else:
             anaconda.id.ksdata.skipSteps.extend(["filter", "filtertype"])
 
-class Iscsi(commands.iscsi.F10_Iscsi):
+class Iscsi(commands.iscsi.RHEL6_Iscsi):
     def parse(self, args):
-        tg = commands.iscsi.F10_Iscsi.parse(self, args)
+        tg = commands.iscsi.RHEL6_Iscsi.parse(self, args)
+
+        if tg.iface:
+            active_ifaces = network.getActiveNetDevs()
+            if tg.iface not in active_ifaces:
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="network interface %s required by iscsi %s target is not up" % (tg.iface, tg.target))
+
+        mode = storage.iscsi.iscsi().mode
+        if mode == "none":
+            if tg.iface:
+                storage.iscsi.iscsi().create_interfaces(active_ifaces)
+        elif ((mode == "bind" and not tg.iface)
+              or (mode == "default" and tg.iface)):
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg="iscsi --iface must be specified (binding used) either for all targets or for none")
 
         try:
             storage.iscsi.iscsi().addTarget(tg.ipaddr, tg.port, tg.user,
                                             tg.password, tg.user_in,
                                             tg.password_in,
-                                            target=tg.target)
-            log.info("added iscsi target: %s" %(tg.ipaddr,))
+                                            target=tg.target,
+                                            iface=tg.iface)
+            log.info("added iscsi target %s at %s via %s" %(tg.target,
+                                                            tg.ipaddr,
+                                                            tg.iface))
         except (IOError, ValueError), e:
             raise KickstartValueError, formatErrorMsg(self.lineno,
                                                       msg=str(e))
diff --git a/storage/iscsi.py b/storage/iscsi.py
index 34c4ad0..7e93113 100644
--- a/storage/iscsi.py
+++ b/storage/iscsi.py
@@ -369,7 +369,7 @@ class iscsi(object):
     # 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, intf=None, target=None):
+                  user_in=None, pw_in=None, intf=None, target=None, iface=None):
         found = 0
         logged_in = 0
 
@@ -383,6 +383,12 @@ class iscsi(object):
                 log.debug("iscsi: skipping logging to iscsi node '%s'" %
                           node.name)
                 continue
+            if iface:
+                node_net_iface = self.ifaces.get(node.iface, node.iface)
+                if iface != node_net_iface:
+                    log.debug("iscsi: skipping logging to iscsi node '%s' via %s" %
+                               (node.name, node_net_iface))
+                    continue
 
             found = found + 1
 
@@ -406,6 +412,8 @@ class iscsi(object):
         for n in self.active_nodes():
             f.write("iscsi --ipaddr %s --port %s --target %s" %
                     (n.address, n.port, n.name))
+            if n.iface != "default":
+                f.write(" --iface %s" % self.ifaces[n.iface])
             auth = n.getAuth()
             if auth:
                 f.write(" --user %s" % auth.username)
-- 
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux