From: Andrew Schoen Date: Thu, 19 Oct 2017 17:01:57 +0000 (-0500) Subject: ceph-volume: zap should leave lvs and partitions intact X-Git-Tag: v13.0.1~367^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=caba9fb80b358222192f736bd1b0ab31dca25cec;p=ceph.git 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 --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py index e8dfb5eec2cf..03fd6833566d 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: