From: Mohamad Gebai Date: Sun, 31 Mar 2019 17:04:40 +0000 (-0400) Subject: ceph-volume: add reduce_vg function X-Git-Tag: v15.1.0~2912^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce0184b5d7f24f2b3b6a9491e0f3c1c847b8c0e7;p=ceph.git ceph-volume: add reduce_vg function Signed-off-by: Mohamad Gebai --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index ca05035b0bd1..e96725b7193a 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -464,6 +464,29 @@ def extend_vg(vg, devices): return vg +def reduce_vg(vg, devices): + """ + Reduce a Volume Group. Command looks like:: + + vgreduce --force --yes group_name [device, ...] + + :param vg: A VolumeGroup object + :param devices: A list of devices to remove from the VG. Optionally, a + single device (as a string) can be used. + """ + if not isinstance(devices, list): + devices = [devices] + process.run([ + 'vgreduce', + '--force', + '--yes', + vg.name] + devices + ) + + vg = get_vg(vg_name=vg.name) + return vg + + def remove_vg(vg_name): """ Removes a volume group.