]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume lvm.api PVolumes should filter by all matching tags, not just one
authorAlfredo Deza <adeza@redhat.com>
Fri, 8 Sep 2017 16:25:57 +0000 (12:25 -0400)
committerAlfredo Deza <adeza@redhat.com>
Mon, 11 Sep 2017 19:26:18 +0000 (15:26 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit b8613c1d7bf56c49d1b7f1c41a37073b8739bbc3)

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

index 27510339fb29bf9dd278f8ac731c519c71c1f7a6..e5bc26234715675543625d42484a14ef3c907114 100644 (file)
@@ -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