]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa: fs Ignore getfattr errors for ceph.dir.pin
authorSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 3 Apr 2019 16:23:21 +0000 (12:23 -0400)
committerSidharth Anupkrishnan <sanupkri@redhat.com>
Thu, 9 May 2019 13:16:21 +0000 (18:46 +0530)
Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
qa/suites/multimds/basic/tasks/cephfs_test_exports.yaml
qa/tasks/cephfs/test_exports.py

index b5842b3ef1b9f4d09c9df9f476126a80dcfe8607..46334fe16d09eae9201c467b77e75fe8ff74af51 100644 (file)
@@ -1,4 +1,5 @@
 tasks:
 - cephfs_test_runner:
+    fail_on_skip: false
     modules:
       - tasks.cephfs.test_exports
index b0cb0461a315326d1b1c9a71f7454c10d163fa3e..44f18005de16689b70f695c9baa83d1478de79fe 100644 (file)
@@ -1,5 +1,6 @@
 import logging
 import time
+from StringIO import StringIO
 from tasks.cephfs.fuse_mount import FuseMount
 from tasks.cephfs.cephfs_test_case import CephFSTestCase
 
@@ -24,7 +25,7 @@ class TestExports(CephFSTestCase):
                     self.assertTrue(s['export_pin'] == s['auth_first'])
                 return subtrees
             time.sleep(pause)
-        raise RuntimeError("rank {0} failed to reach desired subtree state", rank)
+        raise RuntimeError("rank {0} failed to reach desired subtree state".format(rank))
 
     def test_export_pin(self):
         self.fs.set_max_mds(2)
@@ -113,10 +114,45 @@ class TestExports(CephFSTestCase):
         else:
             self._wait_subtrees(status, 0, [('/1', 0), ('/1/4/5', 1), ('/a', 1), ('/a/b/aa/bb', 0)])
 
-        # Test getfattr
-        self.assertTrue(self.mount_a.getfattr("1", "ceph.dir.pin") == "0")
-        self.assertTrue(self.mount_a.getfattr("1/4", "ceph.dir.pin") == "-1")
-        self.assertTrue(self.mount_a.getfattr("1/4/5", "ceph.dir.pin") == "1")
+    def test_export_pin_getfattr(self):
+        self.fs.set_max_mds(2)
+        self.fs.wait_for_daemons()
+
+        status = self.fs.status()
+
+        self.mount_a.run_shell(["mkdir", "-p", "1/2/3"])
+        self._wait_subtrees(status, 0, [])
+
+        # pin /1 to rank 0
+        self.mount_a.setfattr("1", "ceph.dir.pin", "1")
+        self._wait_subtrees(status, 1, [('/1', 1)])
+
+        # pin /1/2 to rank 1
+        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.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.setfattr("1/2/3", "ceph.dir.pin", "2")
+        self._wait_subtrees(status, 0, [('/1', 1), ('/1/2', 0)])
+
+        if len(list(status.get_standbys())):
+            self.fs.set_max_mds(3)
+            self.fs.wait_for_state('up:active', rank=2)
+            self._wait_subtrees(status, 0, [('/1', 1), ('/1/2', 0), ('/1/2/3', 2)])
+
+        if not isinstance(self.mount_a, FuseMount):
+            p = self.mount_a.client_remote.run(args=['uname', '-r'], stdout=StringIO(), wait=True)
+            dir_pin = self.mount_a.getfattr("1", "ceph.dir.pin")
+            log.debug("mount.getfattr('1','ceph.dir.pin'): %s " % dir_pin)
+           if str(p.stdout.getvalue()) < "5" and not(dir_pin):
+               self.skipTest("Kernel does not support getting the extended attribute ceph.dir.pin")
+        self.assertTrue(self.mount_a.getfattr("1", "ceph.dir.pin") == "1")
+        self.assertTrue(self.mount_a.getfattr("1/2", "ceph.dir.pin") == "0")
         if (len(self.fs.get_active_names()) > 2):
             self.assertTrue(self.mount_a.getfattr("1/2/3", "ceph.dir.pin") == "2")