summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--storage/devices.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/storage/devices.py b/storage/devices.py
index 40501d707..817d0194f 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2090,6 +2090,22 @@ 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)