Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jewel: librbd: metadata_set API operation should not change global config setting #13168

Merged
merged 1 commit into from Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librbd/internal.cc
Expand Up @@ -2866,8 +2866,9 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
size_t conf_prefix_len = start.size();

if(key.size() > conf_prefix_len && !key.compare(0,conf_prefix_len,start)) {
// validate config setting
string subkey = key.substr(conf_prefix_len, key.size()-conf_prefix_len);
int r = cct->_conf->set_val(subkey.c_str(), value);
int r = md_config_t().set_val(subkey.c_str(), value);
if (r < 0)
return r;
}
Expand Down
5 changes: 5 additions & 0 deletions src/test/librbd/test_librbd.cc
Expand Up @@ -3585,6 +3585,11 @@ TEST_F(TestLibRBD, Metadata)
ASSERT_EQ(1U, pairs.size());
ASSERT_EQ(0, strncmp("value2", pairs["key2"].c_str(), 6));

// test config setting
ASSERT_EQ(0, image1.metadata_set("conf_rbd_cache", "false"));
ASSERT_EQ(-EINVAL, image1.metadata_set("conf_rbd_cache", "INVALID_VALUE"));
ASSERT_EQ(0, image1.metadata_remove("conf_rbd_cache"));

// test metadata with snapshot adding
ASSERT_EQ(0, image1.snap_create("snap1"));
ASSERT_EQ(0, image1.snap_protect("snap1"));
Expand Down