]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: make get_vg() accepts list of VGs
authorRishabh Dave <ridave@redhat.com>
Sat, 12 Oct 2019 11:29:57 +0000 (16:59 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 18 Oct 2019 08:46:03 +0000 (14:16 +0530)
...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 <ridave@redhat.com>
src/ceph-volume/ceph_volume/api/lvm.py

index 86c81618cf8918da7bf5c0b8916af497d3ac25a4..0f86785508c8784e9f2b0be9b245ebcaa9edc699 100644 (file)
@@ -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)