]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: make get_pv() accepts list of PVs 31407/head
authorRishabh Dave <ridave@redhat.com>
Sat, 12 Oct 2019 11:32:33 +0000 (17:02 +0530)
committerNathan Cutler <ncutler@suse.com>
Tue, 5 Nov 2019 11:36:24 +0000 (12:36 +0100)
...so that the code calling it can pass its copy which would prevent
creating a new one within get_pv().

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 2cdf467f76ab3331c04bec2b9f0e198ff67dd2dd)

src/ceph-volume/ceph_volume/api/lvm.py

index 0f86785508c8784e9f2b0be9b245ebcaa9edc699..b6661522e342271a8b25cfa4b24c8dd9ab05d099 100644 (file)
@@ -496,7 +496,7 @@ def remove_pv(pv_name):
     )
 
 
-def get_pv(pv_name=None, pv_uuid=None, pv_tags=None):
+def get_pv(pv_name=None, pv_uuid=None, pv_tags=None, pvs=None):
     """
     Return a matching pv (physical volume) for the current system, requiring
     ``pv_name``, ``pv_uuid``, or ``pv_tags``. Raises an error if more than one
@@ -504,7 +504,9 @@ def get_pv(pv_name=None, pv_uuid=None, pv_tags=None):
     """
     if not any([pv_name, pv_uuid, pv_tags]):
         return None
-    pvs = PVolumes()
+    if pvs is None or len(pvs) == 0:
+        pvs = PVolumes()
+
     return pvs.get(pv_name=pv_name, pv_uuid=pv_uuid, pv_tags=pv_tags)