[PATCH] Remove missing PVs before removing obsolete VG (#481698).

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

 



Missing PV (e.g. due to drive removal) of obsolete VG
can make lvm vgremove call fail.
Also add verbose flag to pvremove call.
---
 lvm.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lvm.py b/lvm.py
index 0272ca5..0439304 100644
--- a/lvm.py
+++ b/lvm.py
@@ -166,7 +166,17 @@ def vgremove(vgname):
     except:
         pass
 
-    args = ["lvm", "vgremove", vgname]
+    args = ["lvm", "vgreduce", "-v", "--removemissing", "--force", vgname]
+
+    log(string.join(args, ' '))
+    rc = iutil.execWithRedirect(args[0], args,
+                                stdout = output,
+                                stderr = output,
+                                searchPath = 1)
+    if rc:
+        raise SystemError, "vgreduce failed"
+
+    args = ["lvm", "vgremove", "-v", vgname]
 
     log(string.join(args, ' '))
     rc = iutil.execWithRedirect(args[0], args,
@@ -178,7 +188,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 = ["lvm", "pvremove", pvname]
+        args = ["lvm", "pvremove", "-ff", "-y", "-v", pvname]
 
         log(string.join(args, ' '))
         rc = iutil.execWithRedirect(args[0], args,
-- 
1.6.0.6

_______________________________________________
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