]> git.proxmox.com Git - ceph.git/blobdiff - ceph/qa/tasks/cephfs/test_exports.py
update sources to v12.1.0
[ceph.git] / ceph / qa / tasks / cephfs / test_exports.py
index 7cbf464a9530fe80a1d14efd7b7bd80356a90cb7..80f876ebca301d749969106ec8692784012a46b3 100644 (file)
@@ -6,6 +6,8 @@ from tasks.cephfs.cephfs_test_case import CephFSTestCase
 log = logging.getLogger(__name__)
 
 class TestExports(CephFSTestCase):
+    MDSS_REQUIRED = 2
+
     def _wait_subtrees(self, status, rank, test):
         timeout = 30
         pause = 2
@@ -13,9 +15,8 @@ class TestExports(CephFSTestCase):
         for i in range(timeout/pause):
             subtrees = self.fs.mds_asok(["get", "subtrees"], mds_id=status.get_rank(self.fs.id, rank)['name'])
             subtrees = filter(lambda s: s['dir']['path'].startswith('/'), subtrees)
-            log.info(subtrees)
             filtered = sorted([(s['dir']['path'], s['auth_first']) for s in subtrees])
-            log.info(filtered)
+            log.info("%s =?= %s", filtered, test)
             if filtered == test:
                 return subtrees
             time.sleep(pause)
@@ -31,15 +32,15 @@ class TestExports(CephFSTestCase):
         self._wait_subtrees(status, 0, [])
 
         # NOP
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "-1", "1"])
+        self.mount_a.setfattr("1", "ceph.dir.pin", "-1")
         self._wait_subtrees(status, 0, [])
 
         # NOP (rank < -1)
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "-2341", "1"])
+        self.mount_a.setfattr("1", "ceph.dir.pin", "-2341")
         self._wait_subtrees(status, 0, [])
 
         # pin /1 to rank 1
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "1", "1"])
+        self.mount_a.setfattr("1", "ceph.dir.pin", "1")
         self._wait_subtrees(status, 1, [('/1', 1)])
 
         # Check export_targets is set properly
@@ -49,34 +50,34 @@ class TestExports(CephFSTestCase):
         self.assertTrue(sorted(r0['export_targets']) == [1])
 
         # redundant pin /1/2 to rank 1
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "1", "1/2"])
+        self.mount_a.setfattr("1/2", "ceph.dir.pin", "1")
         self._wait_subtrees(status, 1, [('/1', 1), ('/1/2', 1)])
 
         # change pin /1/2 to rank 0
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "0", "1/2"])
+        self.mount_a.setfattr("1/2", "ceph.dir.pin", "0")
         self._wait_subtrees(status, 1, [('/1', 1), ('/1/2', 0)])
         self._wait_subtrees(status, 0, [('/1', 1), ('/1/2', 0)])
 
         # change pin /1/2/3 to (presently) non-existent rank 2
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "2", "1/2/3"])
+        self.mount_a.setfattr("1/2/3", "ceph.dir.pin", "2")
         self._wait_subtrees(status, 0, [('/1', 1), ('/1/2', 0)])
         self._wait_subtrees(status, 1, [('/1', 1), ('/1/2', 0)])
 
         # change pin /1/2 back to rank 1
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "1", "1/2"])
+        self.mount_a.setfattr("1/2", "ceph.dir.pin", "1")
         self._wait_subtrees(status, 1, [('/1', 1), ('/1/2', 1)])
 
         # add another directory pinned to 1
         self.mount_a.run_shell(["mkdir", "-p", "1/4/5"])
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "1", "1/4/5"])
+        self.mount_a.setfattr("1/4/5", "ceph.dir.pin", "1")
         self._wait_subtrees(status, 1, [('/1', 1), ('/1/2', 1), ('/1/4/5', 1)])
 
         # change pin /1 to 0
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "0", "1"])
+        self.mount_a.setfattr("1", "ceph.dir.pin", "0")
         self._wait_subtrees(status, 0, [('/1', 0), ('/1/2', 1), ('/1/4/5', 1)])
 
         # change pin /1/2 to default (-1); does the subtree root properly respect it's parent pin?
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "-1", "1/2"])
+        self.mount_a.setfattr("1/2", "ceph.dir.pin", "-1")
         self._wait_subtrees(status, 0, [('/1', 0), ('/1/4/5', 1)])
 
         if len(list(status.get_standbys())):
@@ -96,8 +97,8 @@ class TestExports(CephFSTestCase):
 
         # Test rename
         self.mount_a.run_shell(["mkdir", "-p", "a/b", "aa/bb"])
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "1", "a"])
-        self.mount_a.run_shell(["setfattr", "-n", "ceph.dir.pin", "-v", "0", "aa/bb"])
+        self.mount_a.setfattr("a", "ceph.dir.pin", "1")
+        self.mount_a.setfattr("aa/bb", "ceph.dir.pin", "0")
         self._wait_subtrees(status, 0, [('/1', 0), ('/1/4/5', 1), ('/1/2/3', 2), ('/a', 1), ('/aa/bb', 0)])
         self.mount_a.run_shell(["mv", "aa", "a/b/"])
         self._wait_subtrees(status, 0, [('/1', 0), ('/1/4/5', 1), ('/1/2/3', 2), ('/a', 1), ('/a/b/aa/bb', 0)])