From: Rishabh Dave Date: Sat, 12 Oct 2019 11:29:57 +0000 (+0530) Subject: ceph-volume: make get_vg() accepts list of VGs X-Git-Tag: v13.2.9~118^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f57483ea677abd20fe8f8c268c7182fed1f7e383;p=ceph.git ceph-volume: make get_vg() accepts list of VGs ...so that the code calling it can pass its copy which would prevent creating a new one within get_vg(). Signed-off-by: Rishabh Dave (cherry picked from commit cde092f4c7e89a67b6c94dcedd41525c11987ef3) --- diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 86c81618cf89..0f86785508c8 100644 --- a/src/ceph-volume/ceph_volume/api/lvm.py +++ b/src/ceph-volume/ceph_volume/api/lvm.py @@ -841,7 +841,7 @@ def remove_vg(vg_name): ) -def get_vg(vg_name=None, vg_tags=None): +def get_vg(vg_name=None, vg_tags=None, vgs=None): """ Return a matching vg for the current system, requires ``vg_name`` or ``tags``. Raises an error if more than one vg is found. @@ -851,7 +851,9 @@ def get_vg(vg_name=None, vg_tags=None): """ if not any([vg_name, vg_tags]): return None - vgs = VolumeGroups() + if vgs is None or len(vgs) == 0: + vgs = VolumeGroups() + return vgs.get(vg_name=vg_name, vg_tags=vg_tags)