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)
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