mirror of
https://github.com/ceph/ceph
synced 2025-01-18 17:12:29 +00:00
mon/OSDMonitor: ENOENT on removing non-existent app key
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>
This commit is contained in:
parent
b4dcdecb6a
commit
450633b9e6
@ -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 ls detail --format=json | grep '"application_metadata":{"rbd":{"key1":"value1"},"rgw":{}}'
|
||||||
ceph osd pool application rm app_for_test rbd key1
|
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 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
|
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
|
ceph osd pool application disable app_for_test rgw --yes-i-really-mean-it
|
||||||
|
@ -6498,8 +6498,14 @@ int OSDMonitor::prepare_command_pool_application(const string &prefix,
|
|||||||
|
|
||||||
string key;
|
string key;
|
||||||
cmd_getval(g_ceph_context, cmdmap, "key", 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 '"
|
ss << "removed application '" << app << "' key '" << key << "' on pool '"
|
||||||
<< pool_name << "'";
|
<< pool_name << "'";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user