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

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

 



---
 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)
-- 
1.6.2.5

_______________________________________________
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