From: Jos Collin Date: Wed, 4 May 2022 13:03:12 +0000 (+0530) Subject: qa: fix is_addr_blocklisted() to get blocklisted clients from 'osd dump' X-Git-Tag: v17.2.1~15^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=265f285a96954864435e543e5fe9e6e8fe5f8bfd;p=ceph.git 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) --- 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