]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/tasks/cephfs/test_journal_repair.py
import 15.2.5
[ceph.git] / ceph / qa / tasks / cephfs / test_journal_repair.py
index 61037b96d7320d3f4d48d67e2cfbf10bfdb8c324..b810e1a28eff814a4399cdc9085067f90c08c232 100644 (file)
@@ -159,11 +159,8 @@ class TestJournalRepair(CephFSTestCase):
 
         # Set max_mds to 2
         self.fs.set_max_mds(2)
-
-        # See that we have two active MDSs
-        self.wait_until_equal(lambda: len(self.fs.get_active_names()), 2, 30,
-                              reject_fn=lambda v: v > 2 or v < 1)
-        active_mds_names = self.fs.get_active_names()
+        status = self.fs.wait_for_daemons()
+        active_mds_names = self.fs.get_active_names(status=status)
 
         # Switch off any unneeded MDS daemons
         for unneeded_mds in set(self.mds_cluster.mds_ids) - set(active_mds_names):
@@ -171,27 +168,13 @@ class TestJournalRepair(CephFSTestCase):
             self.mds_cluster.mds_fail(unneeded_mds)
 
         # Create a dir on each rank
-        self.mount_a.run_shell(["mkdir", "alpha"])
-        self.mount_a.run_shell(["mkdir", "bravo"])
+        self.mount_a.run_shell_payload("mkdir {alpha,bravo} && touch {alpha,bravo}/file")
         self.mount_a.setfattr("alpha/", "ceph.dir.pin", "0")
         self.mount_a.setfattr("bravo/", "ceph.dir.pin", "1")
 
-        def subtrees_assigned():
-            got_subtrees = self.fs.mds_asok(["get", "subtrees"], mds_id=active_mds_names[0])
-
-            for s in got_subtrees:
-                if s['dir']['path'] == '/bravo':
-                    if s['auth_first'] == 1:
-                        return True
-                    else:
-                        # Should not happen
-                        raise RuntimeError("/bravo is subtree but not rank 1!")
-
-            return False
-
         # Ensure the pinning has taken effect and the /bravo dir is now
         # migrated to rank 1.
-        self.wait_until_true(subtrees_assigned, 30)
+        self._wait_subtrees([('/bravo', 1), ('/alpha', 0)], rank=0, status=status)
 
         # Do some IO (this should be split across ranks according to
         # the rank-pinned dirs)