From 731610f18b9e4109ce72a4467af209144e4a127d Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 17 Oct 2017 14:15:18 -0500 Subject: [PATCH] ceph-volume: stubs out the ceph-volume lvm zap command Signed-off-by: Andrew Schoen (cherry picked from commit 2e64b797ef6ae91623ffba8ae28d3f8ccc7d7b93) --- .../ceph_volume/devices/lvm/main.py | 2 + .../ceph_volume/devices/lvm/zap.py | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/ceph-volume/ceph_volume/devices/lvm/zap.py diff --git a/src/ceph-volume/ceph_volume/devices/lvm/main.py b/src/ceph-volume/ceph_volume/devices/lvm/main.py index 43b4e56f5d4ee..8b698a03f64ca 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 0000000000000..3d6917b1095ea --- /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) -- 2.39.5