]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: switch remove_vg and remove_pv to process.run
authorAndrew Schoen <aschoen@redhat.com>
Thu, 18 Jan 2018 20:31:20 +0000 (14:31 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 18 Jan 2018 20:31:20 +0000 (14:31 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/api/lvm.py

index a88daa7082f56c8ced415bf91e3762dfa8e63870..31f38eeca7644823d7440e1158740bfc9a2312ae 100644 (file)
@@ -214,45 +214,33 @@ def create_vg(name, *devices):
 def remove_vg(vg_name):
     """
     Removes a volume group.
-
-    Will return True if the vg is successfully removed or
-    raises a RuntimeError if the removal fails.
     """
-    stdout, stderr, returncode = process.call(
+    fail_msg = "Unable to remove vg %s".format(vg_name)
+    process.run(
         [
             'vgremove',
             '-v',  # verbose
             '-f',  # force it
             vg_name
         ],
-        show_command=True,
-        terminal_verbose=True,
+        fail_msg=fail_msg,
     )
-    if returncode != 0:
-        raise RuntimeError("Unable to remove vg %s".format(vg_name))
-    return True
 
 
 def remove_pv(pv_name):
     """
     Removes a physical volume.
-
-    Will return True if the pv is successfully removed or
-    raises a RuntimeError if the removal fails.
     """
-    stdout, stderr, returncode = process.call(
+    fail_msg = "Unable to remove vg %s".format(pv_name)
+    process.run(
         [
             'pvremove',
             '-v',  # verbose
             '-f',  # force it
             pv_name
         ],
-        show_command=True,
-        terminal_verbose=True,
+        fail_msg=fail_msg,
     )
-    if returncode != 0:
-        raise RuntimeError("Unable to remove vg %s".format(pv_name))
-    return True
 
 
 def remove_lv(path):