From 265f285a96954864435e543e5fe9e6e8fe5f8bfd Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Wed, 4 May 2022 18:33:12 +0530 Subject: [PATCH] qa: fix is_addr_blocklisted() to get blocklisted clients from 'osd dump' 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 (cherry picked from commit 47de5d79b8190458847072aae1c29db7d6a9b66b) --- qa/tasks/cephfs/filesystem.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 65af4adaa2f01..c8cdbedd1c6fd 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -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 -- 2.39.5