From: Alfredo Deza Date: Fri, 8 Sep 2017 16:25:57 +0000 (-0400) Subject: ceph-volume lvm.api PVolumes should filter by all matching tags, not just one X-Git-Tag: v13.0.1~958^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b8613c1d7bf56c49d1b7f1c41a37073b8739bbc3;p=ceph.git ceph-volume lvm.api PVolumes should filter by all matching tags, not just one Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/api.py b/src/ceph-volume/ceph_volume/devices/lvm/api.py index 27510339fb29b..e5bc262347156 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/api.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/api.py @@ -488,11 +488,10 @@ class PVolumes(list): # or is an actual filtered list if any filters were applied if pv_tags: tag_filtered = [] - for k, v in pv_tags.items(): - for pvolume in filtered: - if pvolume.tags.get(k) == str(v): - if pvolume not in tag_filtered: - tag_filtered.append(pvolume) + for pvolume in filtered: + matches = all(pvolume.tags.get(k) == str(v) for k, v in pv_tags.items()) + if matches: + tag_filtered.append(pvolume) # return the tag_filtered pvolumes here, the `filtered` list is no # longer useable return tag_filtered