From e0b4daba8fd0a84b79a32ddcf586223c99112a19 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 13 Nov 2018 16:56:02 -0500 Subject: [PATCH] ceph-volume api.lvm allow passing a Volume object to remove_lv Signed-off-by: Alfredo Deza (cherry picked from commit e7daa71604f4d08ace1125bb63dcfe909796d3ab) --- src/ceph-volume/ceph_volume/api/lvm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index f6527e33f595a..aed4a8f6417c4 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -505,13 +505,20 @@ def remove_pv(pv_name): ) -def remove_lv(path): +def remove_lv(lv): """ Removes a logical volume given it's absolute path. Will return True if the lv is successfully removed or raises a RuntimeError if the removal fails. + + :param lv: A ``Volume`` object or the path for an LV """ + if isinstance(lv, Volume): + path = lv.lv_path + else: + path = lv + stdout, stderr, returncode = process.call( [ 'lvremove', -- 2.39.5