From: Andrew Schoen Date: Tue, 17 Oct 2017 19:15:18 +0000 (-0500) Subject: ceph-volume: stubs out the ceph-volume lvm zap command X-Git-Tag: v13.0.1~367^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e64b797ef6ae91623ffba8ae28d3f8ccc7d7b93;p=ceph.git ceph-volume: stubs out the ceph-volume lvm zap command Signed-off-by: Andrew Schoen --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/main.py b/src/ceph-volume/ceph_volume/devices/lvm/main.py index 43b4e56f5d4..8b698a03f64 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/main.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/main.py @@ -6,6 +6,7 @@ from . import prepare from . import create from . import trigger from . import listing +from . import zap class LVM(object): @@ -24,6 +25,7 @@ class LVM(object): 'create': create.Create, 'trigger': trigger.Trigger, 'list': listing.List, + 'zap': zap.Zap, } def __init__(self, argv): diff --git a/src/ceph-volume/ceph_volume/devices/lvm/zap.py b/src/ceph-volume/ceph_volume/devices/lvm/zap.py new file mode 100644 index 00000000000..3d6917b1095 --- /dev/null +++ b/src/ceph-volume/ceph_volume/devices/lvm/zap.py @@ -0,0 +1,49 @@ +import argparse + +from textwrap import dedent + + +class Zap(object): + + help = 'Destroy a logical volume or partition.' + + def __init__(self, argv): + self.argv = argv + + def zap(self, args): + pass + + 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. + + Example calls for supported scenarios: + + Zapping a logical volume: + + ceph-volume lvm zap {vg name/lv name} + + Zapping a partition: + + ceph-volume lvm zap /dev/sdc1 + + """) + parser = argparse.ArgumentParser( + prog='ceph-volume lvm zap', + formatter_class=argparse.RawDescriptionHelpFormatter, + description=sub_command_help, + ) + + parser.add_argument( + 'device', + metavar='DEVICE', + nargs='?', + help='Path to an lv (as vg/lv) or to a partition like /dev/sda1' + ) + if len(self.argv) == 0: + print(sub_command_help) + return + args = parser.parse_args(self.argv) + self.zap(args)