]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: ENOENT on removing non-existent app key 16530/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 22 Jul 2017 10:14:17 +0000 (18:14 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 25 Jul 2017 05:19:35 +0000 (13:19 +0800)
So we don't bother to trigger an pool update, which is potentially
big stuff.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
qa/workunits/cephtool/test.sh
src/mon/OSDMonitor.cc

index f7f45ccc41a87fd1b3bd0a2cde57e612fa5e4e52..f66df5a7e443a0044b10de80666f65c7e2416f03 100755 (executable)
@@ -2374,6 +2374,7 @@ function test_mon_pool_application()
   ceph osd pool ls detail --format=json | grep '"application_metadata":{"rbd":{"key1":"value1"},"rgw":{}}'
   ceph osd pool application rm app_for_test rbd key1
   ceph osd pool ls detail --format=json | grep '"application_metadata":{"rbd":{},"rgw":{}}'
+  ceph osd pool application rm app_for_test rbd key1 # should be idempotent
 
   expect_false ceph osd pool application disable app_for_test rgw
   ceph osd pool application disable app_for_test rgw --yes-i-really-mean-it
index d39c3eed061d4912a6774ba6aeb9e764af825316..3e9fae1cf4864b991147b2d068b6b830db9810b3 100644 (file)
@@ -6498,8 +6498,14 @@ int OSDMonitor::prepare_command_pool_application(const string &prefix,
 
     string key;
     cmd_getval(g_ceph_context, cmdmap, "key", key);
+    auto it = p.application_metadata[app].find(key);
+    if (it == p.application_metadata[app].end()) {
+      ss << "application '" << app << "' on pool '" << pool_name
+         << "' does not have key '" << key << "'";
+      return 0; // idempotent
+    }
 
-    p.application_metadata[app].erase(key);
+    p.application_metadata[app].erase(it);
     ss << "removed application '" << app << "' key '" << key << "' on pool '"
        << pool_name << "'";
   } else {