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

[PATCH] RHEL 5.3 #469700 - wipe old lvm metadata



Hi,

this patch is a port of bugfix #257161 from rhel4 to fix bug #469700 (and most probably its
dupe #468431, the issue was also probably met in #466902).

Radek
diff --git a/fsset.py b/fsset.py
index 5b3b4e8..254e19f 100644
--- a/fsset.py
+++ b/fsset.py
@@ -2605,6 +2605,26 @@ class VolumeGroupDevice(Device):
 
         if not self.isSetup:
             # rescan now that we've recreated pvs.  ugh.
+            lvm.writeForceConf()            
+            lvm.vgscan()
+
+            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
+
+            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
+
+            # rescan now that we've tried to nuke obsolete vgs.  woo.
             lvm.writeForceConf()
             lvm.vgscan()
 

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