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

Re: [PATCH 3/4] Make deviceNameToDiskByPath check udev info instead of sysfs


Some more comments from reviewing patch 4 in this set.

On 05/04/2010 06:46 AM, David Cantrell wrote:
Rather than scanning /dev/disk/by-path directly, check the udev database
for the PATH_ID or ID_PATH or whatever it's called that gives us the
devlink name that would appear in /dev/disk/by-path.  Sometimes the
links in /dev/disk/by-path do not appear because you have them already
in /dev/disk/by-id (or not, who knows?).  At any rate, stop checking the
/dev/disk/by-path directory manually and just ask udev.

Related: rhbz#560702
  storage/devices.py |   24 ++++++------------------
  1 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 399802b..5761d05 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -147,28 +147,16 @@ def devicePathToName(devicePath):

  def deviceNameToDiskByPath(deviceName=None):
-    bypath = '/dev/disk/by-path'
      if not deviceName:
          return ""
+    else:
+        deviceName = os.path.basename(deviceName)

You cannot simply convert a path to a name this way, instead
you should use devicePathToName, or better fix all callers
of deviceNameToDiskByPath to pass in a name as the function
name suggests. You're already doing this for the
usage in dasd.py, this only leaves one usage in
devices.py PartitionDevice.fstabSpec() and one usage
in devicetree.py to fixup.



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