]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: zap should leave lvs and partitions intact
authorAndrew Schoen <aschoen@redhat.com>
Thu, 19 Oct 2017 17:01:57 +0000 (12:01 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 30 Oct 2017 15:12:16 +0000 (10:12 -0500)
This will remove filesystems and wipe data from any lv or partition
given to 'ceph-volume lvm zap' but still leave it intact for further
use.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit caba9fb80b358222192f736bd1b0ab31dca25cec)

src/ceph-volume/ceph_volume/devices/lvm/zap.py

index e8dfb5eec2cf03ffe896c33dc1dd1206be50cf85..03fd6833566d0250760170bfa29a01c66af15cfd 100644 (file)
@@ -51,18 +51,25 @@ class Zap(object):
         lv = api.get_lv_from_argument(device)
         if lv:
             # we are zapping a logical volume
-            logger.info("Zapping logical volume: %s", lv.path)
-            terminal.write("Zapping logical volume: %s", lv.path)
-            api.remove_lv(lv.path)
+            path = lv.path
         else:
             # we are zapping a partition
-            pass
+            #TODO: ensure device is a partition
+            path = device
+
+        logger.info("Zapping: %s", path)
+        terminal.write("Zapping: %s", path)
+
+        wipefs(path)
+        zap_data(path)
 
     def main(self):
         sub_command_help = dedent("""
-        Destroys the given logical volume or partition. If given a path to a logical
-        volume it must be in the format of vg name/lv name. The logical volume will then
-        be removed. If given a partition name like /dev/sdc1 the partition will be destroyed.
+        Zaps the given logical volume or partition. If given a path to a logical
+        volume it must be in the format of vg name/lv name. Any filesystems present
+        on the given lv or partition will be removed and all data will be purged.
+
+        However, the lv or partition will be kept intact.
 
         Example calls for supported scenarios: