[rhel7-branch 1/1] network: use ibftx interface for iSCSI from iBFT in dracut (#1077291)

rvykydal installerbot-noreply at redhat.com
Tue Jul 21 14:37:05 UTC 2015


From: Radek Vykydal <rvykydal at redhat.com>

When there was another iface up (beside ibftX device activated due to ip=ibft
boot option) which could be used to access iscsi target configured in iBFT, this
device was set to be used in initramfs with ip= option (eg ip=ens3:dhcp) while
ip=ibft should have been set.

Resolves: rhbz#1077291
---
 pyanaconda/network.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 977417c..31c06a3 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -292,7 +292,10 @@ def dumpMissingDefaultIfcfgs():
 def dracutSetupArgs(networkStorageDevice):
 
     if networkStorageDevice.nic == "default" or ":" in networkStorageDevice.nic:
-        nic = ifaceForHostIP(networkStorageDevice.host_address)
+        if getattr(networkStorageDevice, 'ibft', False):
+            nic = ibftIface()
+        else:
+            nic = ifaceForHostIP(networkStorageDevice.host_address)
         if not nic:
             return ""
     else:
@@ -943,6 +946,13 @@ def get_team_slaves(master_specs):
 
     return slaves
 
+def ibftIface():
+    iface = ""
+    ipopt = flags.cmdline.get('ip')
+    if ipopt and ipopt.startswith('ibft'):
+        iface = ipopt.split(":")[0]
+    return iface
+
 def ifaceForHostIP(host):
     route = iutil.execWithCapture("ip", [ "route", "get", "to", host ])
     if not route:
@@ -1118,7 +1128,11 @@ def usedByRootOnISCSI(iface, storage):
         if (isinstance(d, iScsiDiskDevice) and
             rootdev.dependsOn(d)):
             if d.nic == "default" or ":" in d.nic:
-                if iface == ifaceForHostIP(d.host_address):
+                if getattr(d, 'ibft', False):
+                    deviface = ibftIface()
+                else:
+                    deviface = ifaceForHostIP(d.host_address)
+                if iface == deviface:
                     return True
             elif d.nic == iface:
                 return True


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/66f8e6b71ca633d9a18d6d13b03e01f82aa5a84d


More information about the anaconda-patches mailing list