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
+ return False
+
class MDSCluster(CephCluster):
"""
finally:
self.umount_wait()
- def is_blocklisted(self):
- addr = self.get_global_addr()
- if addr is None:
- log.warn("Couldn't get the client address, so the blocklisted status undetermined")
- return False
-
- blocklist = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd", "blocklist", "ls", "--format=json"))
- for b in blocklist:
- if addr == b["addr"]:
- return True
- return False
-
def create_file(self, filename='testfile', dirname=None, user=None,
check_status=True):
assert(self.is_mounted())
cap_waited, session_timeout
))
- self.assertTrue(self.mount_a.is_blocklisted())
+ self.assertTrue(self.mds_cluster.is_addr_blocklisted(
+ self.mount_a.get_global_addr()))
self.mount_a._kill_background(cap_holder)
finally:
self.mount_a.resume_netns()
Check that mds evicts blocklisted client
"""
if not isinstance(self.mount_a, FuseMount):
- self.skipTest("Requires FUSE client to use is_blocklisted()")
+ self.skipTest("Requires FUSE client to use "
+ "mds_cluster.is_addr_blocklisted()")
self.fs.set_max_mds(2)
status = self.fs.wait_for_daemons()
mount_a_client_id = self.mount_a.get_global_id()
self.fs.mds_asok(['session', 'evict', "%s" % mount_a_client_id],
mds_id=self.fs.get_rank(rank=0, status=status)['name'])
- self.wait_until_true(lambda: self.mount_a.is_blocklisted(), timeout=30)
+ self.wait_until_true(lambda: self.mds_cluster.is_addr_blocklisted(
+ self.mount_a.get_global_addr()), timeout=30)
# 10 seconds should be enough for evicting client
time.sleep(10)
if mount is not None:
if evicted:
log.info("confirming client {} is blocklisted".format(client))
- assert mount.is_blocklisted()
+ assert fs.is_addr_blocklisted(mount.get_global_addr())
elif client in no_session:
log.info("client {} should not be evicted but has no session with an MDS".format(client))
- mount.is_blocklisted() # for debugging
+ fs.is_addr_blocklisted(mount.get_global_addr()) # for debugging
should_assert = True
if should_assert:
raise RuntimeError("some clients which should not be evicted have no session with an MDS?")