Re: [PATCH] Use pyblock for device-mapper devices' status.

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

 



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

On Tue, 15 Sep 2009, David Lehman wrote:

On Tue, 2009-09-15 at 13:20 -1000, David Cantrell wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If this provides the same information we're getting from the lvs command, I'm
all for it.  My only concern is whether or not 'live_table' and '!suspended'
are the same as checking the 'a' attribute from the lvs command.  I tend to
not trust the LVM stuff to show up elsewhere.

According to agk (via irc) live_table is the same as the "active" flag.
I threw in the suspended part because it seems to make sense.

Sounds good to me.  Ship it.


Dave


On Tue, 15 Sep 2009, David Lehman wrote:

---
storage/devices.py |   26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index afca755..23bac80 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -1317,6 +1317,16 @@ class DMDevice(StorageDevice):
        """ Return the device specifier for use in /etc/fstab. """
        return self.path

+    @property
+    def status(self):
+        _status = False
+        for map in block.dm.maps():
+            if map.name == self.name:
+                _status = map.live_table and not map.suspended
+                break
+
+        return _status
+
    def updateSysfsPath(self):
        """ Update this device's sysfs path. """
        log_method_call(self, self.name, status=self.status)
@@ -2014,22 +2024,6 @@ class LVMLogicalVolumeDevice(DMDevice):
        """ Test if vg exits and if it has all pvs. """
        return self.vg.complete

-    @property
-    def status(self):
-        """ True if the LV is active, False otherwise. """
-        try:
-            lvstatus = lvm.lvs(self.vg.name)
-        except lvm.LVMError:
-            return False
-
-        try:
-            if lvstatus[self._name]['attr'].find('a') == -1:
-                return False
-            else:
-                return True
-        except KeyError:
-            return False
-
    def setup(self, intf=None):
        """ Open, or set up, a device. """
        log_method_call(self, self.name, status=self.status)


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

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

iEYEARECAAYFAkqwIT4ACgkQ5hsjjIy1Vkl4ZACfZAwboXSNpmn9D5QfMDCIaNes
m2kAoL/dL6Ula8/TyM4Xtra+xd54VIIi
=Q/X8
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


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

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

iEYEARECAAYFAkqwKJsACgkQ5hsjjIy1Vkl4/wCeL5DS9b77V9PhH6thpC182ueS
1/cAoM7GHZ2by/UC0Xh4n4o52LOt5elc
=/kEI
-----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