]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test: create a instance and use tier-flush
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 3 Aug 2020 07:07:46 +0000 (16:07 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 13:09:45 +0000 (22:09 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/test/librados/tier_cxx.cc

index c07cabbee108e5b3c3ef9957805288c1486e9f98..d49e46dfcf31ceab9a0ad99cae52b51885fa1571 100644 (file)
@@ -3001,8 +3001,10 @@ TEST_F(LibRadosTwoPoolsPP, SetChunkRead) {
 
   // create object
   {
+    bufferlist bl;
+    bl.append("There hi");
     ObjectWriteOperation op;
-    op.create(true);
+    op.write_full(bl);
     ASSERT_EQ(0, ioctx.operate("foo", &op));
   }
   {
@@ -3013,14 +3015,6 @@ TEST_F(LibRadosTwoPoolsPP, SetChunkRead) {
     ASSERT_EQ(0, cache_ioctx.operate("bar", &op));
   }
 
-  // configure tier
-  bufferlist inbl;
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier add\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name +
-    "\", \"force_nonempty\": \"--force-nonempty\" }",
-    inbl, NULL, NULL));
-
   // wait for maps to settle
   cluster.wait_for_latest_osdmap();
 
@@ -3039,13 +3033,17 @@ TEST_F(LibRadosTwoPoolsPP, SetChunkRead) {
     completion->release();
   }
 
-  // make all chunks dirty --> full flush --> all chunks are evicted
+  // flush
   {
-    bufferlist bl;
-    bl.append("There hi");
-    ObjectWriteOperation op;
-    op.write_full(bl);
-    ASSERT_EQ(0, ioctx.operate("foo", &op));
+    ObjectReadOperation op;
+    op.tier_flush();
+    librados::AioCompletion *completion = cluster.aio_create_completion();
+    ASSERT_EQ(0, ioctx.aio_operate(
+      "foo", completion, &op,
+      librados::OPERATION_IGNORE_CACHE, NULL));
+    completion->wait_for_complete();
+    ASSERT_EQ(0, completion->get_return_value());
+    completion->release();
   }
 
   // read and verify the object
@@ -3055,11 +3053,6 @@ TEST_F(LibRadosTwoPoolsPP, SetChunkRead) {
     ASSERT_EQ('T', bl[0]);
   }
 
-  ASSERT_EQ(0, cluster.mon_command(
-    "{\"prefix\": \"osd tier remove\", \"pool\": \"" + pool_name +
-    "\", \"tierpool\": \"" + cache_pool_name + "\"}",
-    inbl, NULL, NULL));
-
   // wait for maps to settle before next test
   cluster.wait_for_latest_osdmap();
 }