Merge pull request #18288 from trociny/wip-metadata

test/librbd: test metadata_set/remove is applied

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2017-10-16 10:51:50 -04:00 committed by GitHub
commit 80bb052aa3
2 changed files with 21 additions and 1 deletions

View File

@ -2732,7 +2732,7 @@ int metadata_remove(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
return -EINVAL;
}
CLS_LOG(20, "metdata_set key=%s", key.c_str());
CLS_LOG(20, "metdata_remove key=%s", key.c_str());
int r = cls_cxx_map_remove_key(hctx, metadata_key_for_name(key));
if (r < 0) {

View File

@ -548,6 +548,26 @@ TEST_F(TestInternal, MetadataFilter) {
ASSERT_TRUE(res.size() == 3U);
}
TEST_F(TestInternal, MetadataConfApply) {
REQUIRE_FEATURE(RBD_FEATURE_LAYERING);
librbd::ImageCtx *ictx;
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(-ENOENT, ictx->operations->metadata_remove("conf_rbd_cache"));
bool cache = ictx->cache;
std::string rbd_conf_cache = cache ? "true" : "false";
std::string new_rbd_conf_cache = !cache ? "true" : "false";
ASSERT_EQ(0, ictx->operations->metadata_set("conf_rbd_cache",
new_rbd_conf_cache));
ASSERT_EQ(!cache, ictx->cache);
ASSERT_EQ(0, ictx->operations->metadata_remove("conf_rbd_cache"));
ASSERT_EQ(cache, ictx->cache);
}
TEST_F(TestInternal, SnapshotCopyup)
{
REQUIRE_FEATURE(RBD_FEATURE_LAYERING);