]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: fix TestClientLimits.test_client_oldest_tid
authorYan, Zheng <zyan@redhat.com>
Tue, 13 Oct 2015 03:50:37 +0000 (11:50 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 13 Oct 2015 08:53:39 +0000 (16:53 +0800)
To get the health warning, first we need to make sure requests are
added to session's completed request list. Then we need to send an
extra request to MDS to trigger the code that generates the warning.

Fixes: #13437
Signed-off-by: Yan, Zheng <zyan@redhat.com>
tasks/cephfs/mount.py
tasks/cephfs/test_client_limits.py

index 0757e5709acc1668e922b6dedcd09a8e84b97433..8786680e045b3a9f9654c6e4c5fa36c12e45eeb4 100644 (file)
@@ -349,7 +349,7 @@ class CephFSMount(object):
         self.background_procs.append(rproc)
         return rproc
 
-    def create_n_files(self, fs_path, count):
+    def create_n_files(self, fs_path, count, sync=False):
         assert(self.is_mounted())
 
         abs_path = os.path.join(self.mountpoint, fs_path)
@@ -369,8 +369,11 @@ class CephFSMount(object):
                 fname = "{{0}}_{{1}}".format(abs_path, i)
                 h = open(fname, 'w')
                 h.write('content')
+                if {sync}:
+                    h.flush()
+                    os.fsync(h.fileno())
                 h.close()
-            """).format(abs_path=abs_path, count=count)
+            """).format(abs_path=abs_path, count=count, sync=str(sync))
 
         self.run_python(pyscript)
 
index 6001c4bc8ba87806b222b93d5b827e478739705a..c672bba2e17f576ae7e606b47f9cdc4aaf45a3bf 100644 (file)
@@ -169,7 +169,10 @@ class TestClientLimits(CephFSTestCase):
         self.fs.mds_asok(['config', 'set', 'mds_max_completed_requests', '{0}'.format(max_requests)])
 
         # Create lots of files
-        self.mount_a.create_n_files("testdir/file", max_requests + 100)
+        self.mount_a.create_n_files("testdir/file1", max_requests + 100)
+
+        # Create a few files synchronously. This makes sure previous requests are completed
+        self.mount_a.create_n_files("testdir/file2", 5, True)
 
         # Wait for the health warnings. Assume mds can handle 10 request per second at least
         self.wait_for_health("failing to advance its oldest client/flush tid", max_requests / 10)