[PATCH rhel7-alpha2-branch 09/16] Fix parsing of iscsi iface udev info for offload devices (#811426)

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

 



Resolves: rhbz#811426
---
 pyanaconda/storage/udev.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/storage/udev.py b/pyanaconda/storage/udev.py
index 20833f3..09e9c25 100644
--- a/pyanaconda/storage/udev.py
+++ b/pyanaconda/storage/udev.py
@@ -557,9 +557,16 @@ def udev_device_get_iscsi_port(info):
     return path_components[address_field].split(":")[-1]
 
 def udev_device_get_iscsi_nic(info):
-    session = info["sysfs_path"].split("/")[4]
-    iface = open("/sys/class/iscsi_session/%s/ifacename" %
-                 session).read().strip()
+    # '/devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:01.0/0000:0e:00.2/host3/session1/target3:0:0/3:0:0:0/block/sda'
+    # The position of sessionX part depends on device
+    # (e.g. offload vs. sw; also varies for different offload devs)
+    match = re.match('/.*/(session\d+)', info["sysfs_path"])
+    if match:
+        session = match.groups()[0]
+        iface = open("/sys/class/iscsi_session/%s/ifacename" %
+                     session).read().strip()
+    else:
+        iface = None
     return iface
 
 # fcoe disks have ID_PATH in the form of:
-- 
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