]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
api/lvm: rewrite a condition 31228/head
authorRishabh Dave <ridave@redhat.com>
Tue, 3 Sep 2019 13:06:23 +0000 (18:36 +0530)
committerJan Fajerski <jfajerski@suse.com>
Tue, 29 Oct 2019 16:46:29 +0000 (17:46 +0100)
Create the list of logical volumes if the list passed in arguments is
empty and rewrite the condition to make it more readable.

Fixes: https://tracker.ceph.com/issues/41649
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit d1f1bfd3635501090f4069be59e0bcde94dd64ec)

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

index 92ac2c2283db0b87ce405a9ee5243e04594f13f0..f4f3d6cf5eb11421e1bb3b22b553e9a1e529d4d1 100644 (file)
@@ -274,7 +274,9 @@ def is_lv(dev, lvs=None):
     splitname = dmsetup_splitname(dev)
     # Allowing to optionally pass `lvs` can help reduce repetitive checks for
     # multiple devices at once.
-    lvs = lvs if lvs is not None else Volumes()
+    if lvs is None or len(lvs) == 0:
+        lvs = Volumes()
+
     if splitname.get('LV_NAME'):
         lvs.filter(lv_name=splitname['LV_NAME'], vg_name=splitname['VG_NAME'])
         return len(lvs) > 0