]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: metadata_set API operation should not change global config setting 13168/head
authorMykola Golub <mgolub@mirantis.com>
Mon, 9 Jan 2017 17:31:21 +0000 (18:31 +0100)
committerMykola Golub <mgolub@mirantis.com>
Sat, 28 Jan 2017 17:31:15 +0000 (18:31 +0100)
Fixes: http://tracker.ceph.com/issues/18465
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
(cherry picked from commit 27465b5916b55ac3c2846c74b89f4362ad17ff1e)

Conflicts:
    src/librbd/Operations.cc (after jewel set_metadata migrated to Operations)

src/librbd/internal.cc
src/test/librbd/test_librbd.cc

index 68d195be5e2f7f539b3c9616bd9c18fcad5138b2..baafb2ec494ab0493c91773c5a5b19b482c5914b 100644 (file)
@@ -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;
     }
index 9757a3a9ab525fc6518733e38cb3140f07348057..99b785c2cef7ce632e0077c4384d156d14be4ea7 100644 (file)
@@ -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"));