[PATCH 6/8] Add udev_device_get_by_path() to return /dev/disk/by-path link

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

 



The ID_PATH for a device is not the same as the link in
/dev/disk/by-path.  Based on what I'm seeing, the symlinks list is what
we want to scan for a possible /dev/disk/by-path link.  You cannot use
the ID_PATH value directly because it does not refer to partitions, only
whole devices.

Related: rhbz#589717
Related: rhbz#589713
---
 storage/udev.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/storage/udev.py b/storage/udev.py
index 9ee052b..c9e3ce5 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -292,6 +292,14 @@ def udev_device_get_bus(udev_info):
 def udev_device_get_path(info):
     return info["ID_PATH"]
 
+def udev_device_get_by_path(info):
+    if info.has_key('symlinks'):
+        for link in info['symlinks']:
+            if link.startswith('/dev/disk/by-path/'):
+                return link
+
+    return None
+
 def udev_device_get_sysfs_path(info):
     return info['sysfs_path']
 
-- 
1.6.6.1

_______________________________________________
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