]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd,mds,common: make 'config rm ...' idempotent 22395/head
authorSage Weil <sage@redhat.com>
Mon, 4 Jun 2018 16:00:08 +0000 (11:00 -0500)
committerSage Weil <sage@redhat.com>
Mon, 4 Jun 2018 20:57:40 +0000 (15:57 -0500)
Fixes: http://tracker.ceph.com/issues/24408
Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/mon/config.sh
src/common/ceph_context.cc
src/mds/MDSDaemon.cc
src/osd/OSD.cc

index 547e4e291dc0290172bff9dc77db8f8d747779d0..d97106a4a141bf10fe05b8f2afc1b10b09149fe7 100755 (executable)
@@ -74,6 +74,7 @@ do
 done
 ceph config show osd.0 | grep debug_xio | grep 'override mon'
 ceph tell osd.0 config unset debug_xio
+ceph tell osd.0 config unset debug_xio
 
 ceph config rm osd.0 debug_xio
 while ceph config show osd.0 | grep debug_xio | grep mon
index 80ee593dfeee82169344e3e134865b3f5ca236eb..faaca450b2d59175461313dc433e7f002d10bbb4 100644 (file)
@@ -441,7 +441,7 @@ void CephContext::do_command(std::string_view command, const cmdmap_t& cmdmap,
         f->dump_string("error", "syntax error: 'config unset <var>'");
       } else {
         int r = _conf->rm_val(var.c_str());
-        if (r < 0) {
+        if (r < 0 && r != -ENOENT) {
           f->dump_stream("error") << "error unsetting '" << var << "': "
                                  << cpp_strerror(r);
         } else {
index 757959a4094c742f289ae5cf67590b5d6e24586b..0bc7cf68d911342cf1a35de714bc9f30e7f0dd98 100644 (file)
@@ -794,6 +794,9 @@ int MDSDaemon::_handle_command(
     if (r == 0) {
       cct->_conf->apply_changes(nullptr);
     }
+    if (r == -ENOENT) {
+      r = 0; // idempotent
+    }
   } else if (prefix == "exit") {
     // We will send response before executing
     ss << "Exiting...";
index b23e88fa75389606cff8bc9a5076ad6a751df250..c251caa4396ef93673707ff899b0faad14a03837 100644 (file)
@@ -5828,6 +5828,9 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     if (r == 0) {
       cct->_conf->apply_changes(nullptr);
     }
+    if (r == -ENOENT) {
+      r = 0;  // make command idempotent
+    }
     osd_lock.Lock();
   }
   else if (prefix == "cluster_log") {