From f57483ea677abd20fe8f8c268c7182fed1f7e383 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Sat, 12 Oct 2019 16:59:57 +0530 Subject: [PATCH] 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) --- src/ceph-volume/ceph_volume/api/lvm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/api/lvm.py b/src/ceph-volume/ceph_volume/api/lvm.py index 86c81618cf891..0f86785508c87 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) -- 2.39.5