Re: [PATCH] Add MultipathDevice.updateSysfsPath()

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 9 Oct 2009, Peter Jones wrote:

MultipathDevice needs its own .updateSysfsPath(), because self.name is
"mpath0" but the sysfs directory is /sys/class/block/dm-0 .

Hopefully dm-${MINOR} is good enough.
---
storage/devices.py |    8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 3cc3aac..a0048f3 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2809,6 +2809,14 @@ class MultipathDevice(DiskDevice):
        self._isUp = False
        self._pyBlockMultiPath = None

+    def updateSysfsPath(self):
+        """ Update this device's sysfs path. """
+        log_method_call(self, self.name, status=self.status)
+        path = os.path.join("/sys/class/block", "dm-%d" % \
+                            (self._pyBlockMultiPath.bdev.minor,))
+        self.sysfsPath = os.path.realpath(path)[4:]
+        log.debug("%s sysfsPath set to %s" % (self.name, self.sysfsPath))
+
class NoDevice(StorageDevice):
    """ A nodev device for nodev filesystems like tmpfs. """
    _type = "nodev"


Could use
    get_sysfs_path_by_name("dm-%d" % (self._pyBlockMultiPath.bdev.minor,))

from storage.miscutils instead.  Doesn't really gain much, but we could reduce
the locations where we have "/sys/class/block" coded.

- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkrPrccACgkQ5hsjjIy1VkkCyACeNmBRrOtdBRVJAj1erxzgEMnn
VAMAn1DTmz6tig0AoZzoVJA5OYnQlYlm
=LvVW
-----END PGP SIGNATURE-----

_______________________________________________
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