]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
api/lvm: rewrite a condition 30101/head
authorRishabh Dave <ridave@redhat.com>
Tue, 3 Sep 2019 13:06:23 +0000 (18:36 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 4 Sep 2019 11:19:29 +0000 (16:49 +0530)
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>
src/ceph-volume/ceph_volume/api/lvm.py

index cce8a302cba1ca30743769ba6008993629444513..51e90437d135f2516f5f3c136b43fb2034c8659e 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