[PATCH] RHEL 5.3 #468431 - assure consistency of VG to be removed

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

 



Hi,

this patch is a successor of commit b5a48bfc44a8084b4c751e192c70eb1837e44e19
which fixed only one part of the bug. This one adds these things:

- calls vgreduce before removing VG with vgremove
to put the VG into consistent state (e.g. it removes missing
PVs from VG )
- adds verbose to lvm calls for better logging
- removes silent catching of exceptions
(this is only update of the first patch of the bug)

Note:
While working on the bug I used dirty hack patch to append to lvmout log
instead of rewriting the file with each command
(it changed opening mode in execWithRedirect if filename contained lvmout).
I think it is worth considering to do this (lvm bugs can be very hard
to reproduce so each piece of logged info can be very valuable) in some
cleaner way like adding append kwd param to execWithRedirect or so.
This would likely require also something to separate outputs of commands
in the file. But it would be for 5.4 I guess.

Radek
diff --git a/fsset.py b/fsset.py
index c0c2df6..5f9a1bc 100644
--- a/fsset.py
+++ b/fsset.py
@@ -2611,18 +2611,12 @@ class VolumeGroupDevice(Device):
             for (vg, lv, size, lvorigin) in lvm.lvlist():
                 if vg == self.name:
                     log.info("removing obsolete LV %s/%s" % (vg, lv))
-                    try:
-                        lvm.lvremove(lv, vg)
-                    except SystemError:
-                        pass
+                    lvm.lvremove(lv, vg)
 
             for (vg, size, pesize) in lvm.vglist():
                 if vg == self.name:
                     log.info("removing obsolete VG %s" % (vg,))
-                    try:
-                        lvm.vgremove(self.name)
-                    except SystemError:
-                        pass
+                    lvm.vgremove(self.name)
 
             args = [ "vgcreate", "-v", "-An",
                      "-s", "%sk" %(self.physicalextentsize,),
diff --git a/lvm.py b/lvm.py
index cf76bfd..94ae5fd 100644
--- a/lvm.py
+++ b/lvm.py
@@ -158,7 +158,15 @@ def vgremove(vgname):
     except:
         pass
 
-    args = ["vgremove", vgname]
+    args = ["vgreduce", "-v", "--removemissing", vgname]
+
+    log.info(string.join(args, ' '))
+    rc = iutil.execWithRedirect("lvm", args, stdout = output,
+                                stderr = output, searchPath = 1)
+    if rc:
+        raise SystemError, "vgreduce failed"
+
+    args = ["vgremove", "-v", vgname]
 
     log.info(string.join(args, ' '))
     rc = iutil.execWithRedirect("lvm", args, stdout = output,
@@ -169,7 +177,7 @@ def vgremove(vgname):
     # now iterate all the PVs we've just freed up, so we reclaim the metadata
     # space.  This is an LVM bug, AFAICS.
     for pvname in pvs:
-        args = ["pvremove", "-ff", "-y", pvname]
+        args = ["pvremove", "-ff", "-y", "-v", pvname]
 
         log.info(string.join(args, ' '))
         rc = iutil.execWithRedirect("lvm", args, stdout = output,
_______________________________________________
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