]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: stubs out the ceph-volume lvm zap command
authorAndrew Schoen <aschoen@redhat.com>
Tue, 17 Oct 2017 19:15:18 +0000 (14:15 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Fri, 27 Oct 2017 16:15:42 +0000 (11:15 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/devices/lvm/main.py
src/ceph-volume/ceph_volume/devices/lvm/zap.py [new file with mode: 0644]

index 43b4e56f5d4ee62889691ed5387b1165dc7dda5e..8b698a03f64cab12fe5d4673b956c4fe5964aeeb 100644 (file)
@@ -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 (file)
index 0000000..3d6917b
--- /dev/null
@@ -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)