From 5a1be9a73919e13fe603861588bcc20872a4c133 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 18 Jan 2018 14:31:20 -0600 Subject: [PATCH] ceph-volume: switch remove_vg and remove_pv to process.run Signed-off-by: Andrew Schoen --- src/ceph-volume/ceph_volume/api/lvm.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index a88daa7082f..31f38eeca76 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): -- 2.39.5