]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd,mds,common: make 'config rm ...' idempotent 22552/head
authorSage Weil <sage@redhat.com>
Mon, 4 Jun 2018 16:00:08 +0000 (11:00 -0500)
committerNathan Cutler <ncutler@suse.com>
Wed, 13 Jun 2018 16:46:17 +0000 (18:46 +0200)
Fixes: http://tracker.ceph.com/issues/24408
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 11044f5f1b6221eeb8a7837a9b90cd2a4c39936e)

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 f8988ca74644b95a2644b22dafc1eabf006fcb2a..5fee784edae9fd4b5fa88c28de8b58ea342e9c50 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 4c78c36c8b9e65783f49f62e95253539690086dd..b330f5895f3947d933a12680fc451e3745685598 100644 (file)
@@ -817,6 +817,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 a6cf1883603ca20987f36ebc8b55504b18932591..ca3427460d24f9bfd68d8f736d46b8c3d2a7bdb8 100644 (file)
@@ -5873,6 +5873,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") {