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

[PATCH rhel5-branch pykickstart] Add clearpart --scrublvm option (#462615)



The option ensures that lvm metadata are removed from from all cleared
partitions.
---
 pykickstart/data.py   |    2 +-
 pykickstart/parser.py |    2 ++
 pykickstart/writer.py |    7 ++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/pykickstart/data.py b/pykickstart/data.py
index 54a989e..8d51089 100644
--- a/pykickstart/data.py
+++ b/pykickstart/data.py
@@ -27,7 +27,7 @@ class KickstartData:
         self.encrypted = False
         self.mpaths = []
         self.clearpart = {"drives": [], "initAll": False,
-                          "type": CLEARPART_TYPE_NONE}
+                          "type": CLEARPART_TYPE_NONE, "scrublvm": False}
         self.device = ""
         self.deviceprobe = ""
         self.displayMode = DISPLAY_MODE_GRAPHICAL
diff --git a/pykickstart/parser.py b/pykickstart/parser.py
index 683dbae..5d118e8 100644
--- a/pykickstart/parser.py
+++ b/pykickstart/parser.py
@@ -365,6 +365,8 @@ class KickstartHandlers:
                       const=CLEARPART_TYPE_LINUX)
         op.add_option("--none", dest="type", action="store_const",
                       const=CLEARPART_TYPE_NONE)
+        op.add_option("--scrublvm", dest="scrublvm", action="store_true",
+                      default=False)
 
         (opts, extra) = op.parse_args(args=args)
         self._setToDict(op, opts, self.ksdata.clearpart)
diff --git a/pykickstart/writer.py b/pykickstart/writer.py
index ed50d21..0f2e744 100644
--- a/pykickstart/writer.py
+++ b/pykickstart/writer.py
@@ -128,13 +128,18 @@ class KickstartWriter:
         else:
             initstr = ""
 
+        if self.ksdata.clearpart["scrublvm"]:
+            scrublvmstr = "--scrublvm"
+        else:
+            scrublvmstr = ""
+
         if len(self.ksdata.clearpart["drives"]) > 0:
             drivestr = "--drives=" + \
                        string.join (self.ksdata.clearpart["drives"], ",")
         else:
             drivestr = ""
 
-        return "# Partition clearing information\nclearpart %s %s %s" % (clearstr, initstr, drivestr)
+        return "# Partition clearing information\nclearpart %s %s %s %s" % (clearstr, initstr, drivestr, scrublvmstr)
 
     def doDevice(self):
         if self.ksdata.device != "":
-- 
1.5.4.3


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