Re: [PATCH 06/11] Fix get_sysfs_path_by_name for paths including "mapper/".

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

 



On 05/06/2011 09:15 PM, David Lehman wrote:
---
  pyanaconda/iutil.py |   11 ++++++++---
  1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index 139d61d..6fb0d8b 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -805,9 +805,14 @@ def get_sysfs_path_by_name(dev_node, class_name="block"):
          (e.g. /sys/class/block/vda2). This also has to work for device nodes
          that are in a subdirectory of /dev like '/dev/cciss/c0d0p1'.
       """
-    dev_name = os.path.basename(dev_node)
-    if dev_node.startswith("/dev/"):
-        dev_name = dev_node[5:].replace("/", "!")
+    dev_name = dev_node
+    if dev_name.startswith("/dev/"):
+        dev_name = dev_node[5:]
+
+    if dev_name.startswith("mapper/"):
+        dev_name = dev_node[7:]
+
+    dev_name = dev_name.replace("/", "!")

I don't think this is going to work:

Suppose one passes "/dev/mapper/vg_acid-lv_root":

first you remove the "/dev/"/ part then the "mapper/" part, ending up with "vg-acid-lv-root". But in /sys/class/block, there's only entries like "dm-0" and "dm-1" and so on. What we do now is calling "dm_node_from_name" before calling this function.

I don't know what the right fix should be, perhaps moving the dm name resolution into the function.

Also see https://www.redhat.com/archives/anaconda-devel-list/2011-April/msg00261.html for the same discussion.

Ales

_______________________________________________
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