From 4ee13e0587c5e152fdac18004bc4336f8b90e4af Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 19 Oct 2017 12:01:57 -0500 Subject: [PATCH] ceph-volume: zap should leave lvs and partitions intact 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 (cherry picked from commit caba9fb80b358222192f736bd1b0ab31dca25cec) --- .../ceph_volume/devices/lvm/zap.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py index e8dfb5eec2cf0..03fd6833566d0 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/zap.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/zap.py @@ -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: -- 2.39.5