[PATCH 3/4] Fix result of updateSysfsPath to be consistent with initial sysfsPath values

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

 



Initial sysfsPath values as passed into __init__ at Device creation do not
start with /sys and are canonalized. This patch fixes the various
updateSysfsPath methods to set the sysfsPath attribute to a new value
consistent with this.
---
 storage/devices.py |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index c742337..4caaf0f 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -441,7 +441,7 @@ class StorageDevice(Device):
     """
     _type = "storage device"
     devDir = "/dev"
-    sysfsBlockDir = "/class/block"
+    sysfsBlockDir = "class/block"
     _resizable = False
 
     def __init__(self, device, format=None,
@@ -521,9 +521,8 @@ class StorageDevice(Device):
     def updateSysfsPath(self):
         """ Update this device's sysfs path. """
         log_method_call(self, self.name, status=self.status)
-        self.sysfsPath = os.path.join("/sys",
-                                      self.sysfsBlockDir,
-                                      self.name)
+        path = os.path.join("/sys", self.sysfsBlockDir, self.name)
+        self.sysfsPath = os.path.realpath(path)[4:]
         log.debug("%s sysfsPath set to %s" % (self.name, self.sysfsPath))
 
     @property
@@ -1346,9 +1345,10 @@ class DMDevice(StorageDevice):
 
         if self.status:
             dm_node = self.getDMNode()
-            self.sysfsPath = os.path.join("/sys", self.sysfsBlockDir, dm_node)
+            path = os.path.join("/sys", self.sysfsBlockDir, dm_node)
+            self.sysfsPath = os.path.realpath(path)[4:]
         else:
-            self.sysfsPath = None
+            self.sysfsPath = ''
 
     #def getTargetType(self):
     #    return dm.getDmTarget(name=self.name)
@@ -2148,11 +2148,9 @@ class MDRaidArrayDevice(StorageDevice):
             raise DeviceError("device has not been created")
 
         if self.status:
-            self.sysfsPath = os.path.join("/sys",
-                                          self.sysfsBlockDir,
-                                          self.name)
+            self.sysfsPath = "/devices/virtual/block/%s" % self.name
         else:
-            self.sysfsPath = None
+            self.sysfsPath = ''
 
     def _addDevice(self, device):
         """ Add a new member device to the array.
-- 
1.6.1.3

_______________________________________________
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