Skip to content

Commit a9a5691

Browse files
committed
qa: Wait for mirror daemon restart before getting new rados_inst
After blocklisted/failed, wait for the mirror daemon restart which is after 30 seconds timeout and then check for the new rados_inst. Fixes: https://tracker.ceph.com/issues/64927 Signed-off-by: Jos Collin <[email protected]>
1 parent 96c3f8f commit a9a5691

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

qa/tasks/cephfs/test_mirroring.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def get_mirror_rados_addr(self, fs_name, fs_id):
275275
"""return the rados addr used by cephfs-mirror instance"""
276276
res = self.mirror_daemon_command(f'mirror status for fs: {fs_name}',
277277
'fs', 'mirror', 'status', f'{fs_name}@{fs_id}')
278-
return res['rados_inst']
278+
if 'rados_inst' in res:
279+
return res['rados_inst']
279280

280281
def mirror_daemon_command(self, cmd_label, *args):
281282
asok_path = self.get_daemon_admin_socket()
@@ -491,6 +492,7 @@ def test_cephfs_mirror_blocklist(self):
491492

492493
# fetch rados address for blacklist check
493494
rados_inst = self.get_mirror_rados_addr(self.primary_fs_name, self.primary_fs_id)
495+
self.assertTrue(rados_inst)
494496

495497
# simulate non-responding mirror daemon by sending SIGSTOP
496498
pid = self.get_mirror_daemon_pid()
@@ -509,9 +511,16 @@ def test_cephfs_mirror_blocklist(self):
509511
# check if the rados addr is blocklisted
510512
self.assertTrue(self.mds_cluster.is_addr_blocklisted(rados_inst))
511513

512-
# wait enough so that the mirror daemon restarts blocklisted instances
513-
time.sleep(40)
514-
rados_inst_new = self.get_mirror_rados_addr(self.primary_fs_name, self.primary_fs_id)
514+
# wait for restart, which is after 30 seconds timeout (cephfs_mirror_restart_mirror_on_blocklist_interval)
515+
time.sleep(60)
516+
517+
# get the new rados_inst
518+
rados_inst_new = ""
519+
with safe_while(sleep=2, tries=20, action='wait for mirror status rados_inst') as proceed:
520+
while proceed():
521+
rados_inst_new = self.get_mirror_rados_addr(self.primary_fs_name, self.primary_fs_id)
522+
if rados_inst_new:
523+
break
515524

516525
# and we should get a new rados instance
517526
self.assertTrue(rados_inst != rados_inst_new)

0 commit comments

Comments
 (0)