]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: adds a remove_lv command to the lvm api
authorAndrew Schoen <aschoen@redhat.com>
Wed, 18 Oct 2017 15:19:00 +0000 (10:19 -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/api/lvm.py

index 05f6cb2f07b5c45720001d18889981d79cb9d2b4..8b824f5da586f21bcd313d63cf70633edb0b2c7d 100644 (file)
@@ -213,6 +213,25 @@ def create_vg(name, *devices):
     return vg
 
 
+def remove_lv(path):
+    """
+    Removes a logical volume given it's absolute path.
+    """
+    stdout, stderr, returncode = process.call(
+        [
+            'sudo',
+            'lvremove',
+            '-v',  # verbose
+            '-f',  # force it
+            path
+        ],
+        show_command=True,
+        terminal_verbose=True,
+    )
+    if returncode != 0:
+        raise RuntimeError("Unable to remove %s".format(path))
+
+
 def create_lv(name, group, size=None, tags=None):
     """
     Create a Logical Volume in a Volume Group. Command looks like::