]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: fix is_addr_blocklisted() to get blocklisted clients from 'osd dump'
authorJos Collin <jcollin@redhat.com>
Wed, 4 May 2022 13:03:12 +0000 (18:33 +0530)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 1 Jun 2022 15:08:02 +0000 (15:08 +0000)
By the introduction of range blocklist, the 'blocklist ls' command outputs
two lists. It's also straightforward to get the blocklisted clients directly
from 'osd dump' to avoid regression.

Fixes: https://tracker.ceph.com/issues/55516
Signed-off-by: Jos Collin <jcollin@redhat.com>
(cherry picked from commit 47de5d79b8190458847072aae1c29db7d6a9b66b)

qa/tasks/cephfs/filesystem.py

index 65af4adaa2f0154f477e699c28b4b383f445e630..c8cdbedd1c6fd791040af3c660e465abdcdb53a5 100644 (file)
@@ -263,18 +263,12 @@ class CephCluster(object):
             log.debug("_json_asok output empty")
             return None
 
-    def is_addr_blocklisted(self, addr=None):
-        if addr is None:
-            log.warn("Couldn't get the client address, so the blocklisted "
-                     "status undetermined")
-            return False
-
-        blocklist = json.loads(self.mon_manager.run_cluster_cmd(
-            args=["osd", "blocklist", "ls", "--format=json"],
-            stdout=StringIO()).stdout.getvalue())
-        for b in blocklist:
-            if addr == b["addr"]:
-                return True
+    def is_addr_blocklisted(self, addr):
+        blocklist = json.loads(self.mon_manager.raw_cluster_cmd(
+            "osd", "dump", "--format=json"))['blocklist']
+        if addr in blocklist:
+            return True
+        log.warn(f'The address {addr} is not blocklisted')
         return False