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: v12.2.1~45^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1b92868fa775ab4c210b3fd02e9a4913485db3a;p=ceph.git ceph-volume lvm.api PVolumes should filter by all matching tags, not just one Signed-off-by: Alfredo Deza (cherry picked from commit b8613c1d7bf56c49d1b7f1c41a37073b8739bbc3) --- diff --git a/src/ceph-volume/ceph_volume/devices/lvm/api.py b/src/ceph-volume/ceph_volume/devices/lvm/api.py index 27510339fb29..e5bc26234715 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