// create object
{
+ bufferlist bl;
+ bl.append("There hi");
ObjectWriteOperation op;
- op.create(true);
+ op.write_full(bl);
ASSERT_EQ(0, ioctx.operate("foo", &op));
}
{
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();
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
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();
}