From: Andrew Schoen Date: Thu, 18 Jan 2018 20:31:20 +0000 (-0600) Subject: ceph-volume: switch remove_vg and remove_pv to process.run X-Git-Tag: v13.0.2~453^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5a1be9a73919e13fe603861588bcc20872a4c133;p=ceph.git ceph-volume: switch remove_vg and remove_pv to process.run Signed-off-by: Andrew Schoen --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index a88daa7082f56..31f38eeca7644 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -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):