[PATCH] Indicate LV status according to lv_attr active bit (#491754)

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

 



This should fix up a majority, if not all, of the 'cannot commit to disk
after 5 attempts' errors.  I was hitting this today.  The cause I found
to be active logical volumes still around when the storage code wanted
to commit changes to the disk.  When a logical volume is active,
libparted is getting EBUSY when it tries to commit changes to the disk
and tell the kernel to reread the partition table.  If the LV is active,
we need to deactivate it and the volume group before we start committing
changes to disk.

Adding a status() property to LVMLogicalVolumeDevice that looks at the
lv_attr field for an 'a' fixes the problem for me on F-11.  All of the
code to down LVM devices is there, we just weren't checking the LV
status correctly.
---
 storage/devices.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 40501d7..817d019 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)
-- 
1.6.3.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