[PATCH rhel6-branch] fcoe: keep former nic detection for netxtreme2 drivers (#1008731)

Radek Vykydal rvykydal at redhat.com
Fri Oct 4 13:26:33 UTC 2013


Related: rhbz#1008731
---
 storage/udev.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/storage/udev.py b/storage/udev.py
index 78fb996..f6faf4d 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -617,6 +617,7 @@ def udev_device_get_iscsi_initiator(info):
 # This is completely different for Broadcom FCoE devices (bnx2fc), where we use
 # the sysfs path:
 # /devices/pci0000:00/0000:00:03.0/0000:04:00.3/net/eth3/ctlr_0/host5/rport-5:0-3/target5:0:1/5:0:1:147/block/sdb
+# /devices/pci0000:00/0000:00:03.0/0000:04:00.1/host10/rport-10:0-1/target10:0:0/10:0:0:254/block/sdgy (netxtreme2)
 # and find whether the host has 'fc_host' and if it the device has a bound
 # Ethernet interface.
 
@@ -630,6 +631,16 @@ def _detect_broadcom_fcoe(info):
             return (sysfs_pci, host)
     return (None, None)
 
+def _detect_broadcom_fcoe_netxtreme2(info):
+    re_pci_host=re.compile('/(.*)/(host\d+)')
+    match = re_pci_host.match(info["sysfs_path"])
+    if match:
+        sysfs_pci, host = match.groups()
+        if os.access('/sys/%s/%s/fc_host' %(sysfs_pci, host), os.X_OK) and \
+                os.access('/sys/%s/net' %(sysfs_pci), os.X_OK):
+            return (sysfs_pci, host)
+    return (None, None)
+
 def udev_device_is_fcoe(info):
     if info.get("ID_BUS") != "scsi":
         return False
@@ -671,6 +682,14 @@ def udev_device_get_fcoe_nic(info):
         else:
             return iface
 
+    (sysfs_pci, host) = _detect_broadcom_fcoe_netxtreme2(info)
+    if (sysfs_pci, host) != (None, None):
+        net_path = '/sys/%s/net' % sysfs_pci
+        listdir = os.listdir(net_path)
+        if len(listdir) > 0 :
+            return listdir[0]
+
+
 def udev_device_get_fcoe_identifier(info):
     path = info.get("ID_PATH", "")
     path_components = path.split("-")
-- 
1.7.11.7



More information about the anaconda-patches mailing list