summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-07-07 18:23:08 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-07-08 04:15:33 -1000
commit60ff94ed3fade0716086deeb99892bf1c5103e62 (patch)
tree4ed7882216e7f83541eb681c226c0d6eeb8ffd6c /storage
parent8ae7be3e524fa52ad8f56e998a32559d73144a3b (diff)
downloadanaconda-60ff94ed3fade0716086deeb99892bf1c5103e62.tar.gz
anaconda-60ff94ed3fade0716086deeb99892bf1c5103e62.tar.xz
anaconda-60ff94ed3fade0716086deeb99892bf1c5103e62.zip
Indicate LV status according to lv_attr active bit (#491754)
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.
Diffstat (limited to 'storage')
-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)