]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
config: complains when a setting is not tracked 7085/head
authorKefu Chai <kchai@redhat.com>
Thu, 24 Dec 2015 06:17:41 +0000 (14:17 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 30 Dec 2015 16:35:58 +0000 (00:35 +0800)
* not all config items are tracked, so it does not take any effect after
  we sucessfully changed them using "ceph tell <daemon> injectargs  --foo-bar 15',
  as shown by the command output:
    $daemon: foo_bar = '15'
  if foo-bar happens to be the one not tracked by any components in <daemon>.
  in this fix, the message of
    $daemon: foo_bar = '15' (unchangeable)
  is returned instead. nevertheless, the config is still updated. as
  "ceph daemon <daemon> config show | grep foo_bar" shows:
    "foo_bar": "15"
  this helps user to understand that the setting is not dynamically
  changeable.
* update the test accordingly

Fixes: #11692
Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/workunits/cephtool/test.sh
src/common/config.cc

index 8152c6477252b781a14f97e20302846e746a41dc..2655f4e5a7025cd70e98223bf5b0f229c0b036cd 100755 (executable)
@@ -178,19 +178,22 @@ function ceph_watch_wait()
 
 function test_mon_injectargs()
 {
-  CEPH_ARGS='--mon_debug_dump_location the.dump' ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
-  check_response "osd_debug_op_order = 'false'"
+  CEPH_ARGS='--mon_debug_dump_location the.dump' ceph tell osd.0 injectargs --no-osd_enable_op_tracker >& $TMPFILE || return 1
+  check_response "osd_enable_op_tracker = 'false'"
   ! grep "the.dump" $TMPFILE || return 1
-  ceph tell osd.0 injectargs '--osd_debug_op_order --osd_failsafe_full_ratio .99' >& $TMPFILE || return 1
-  check_response "osd_debug_op_order = 'true' osd_failsafe_full_ratio = '0.99'"
-  ceph tell osd.0 injectargs --no-osd_debug_op_order >& $TMPFILE || return 1
-  check_response "osd_debug_op_order = 'false'"
-  ceph tell osd.0 injectargs -- --osd_debug_op_order >& $TMPFILE || return 1
-  check_response "osd_debug_op_order = 'true'"
-  ceph tell osd.0 injectargs -- '--osd_debug_op_order --osd_failsafe_full_ratio .98' >& $TMPFILE || return 1
-  check_response "osd_debug_op_order = 'true' osd_failsafe_full_ratio = '0.98'" 
-  ceph tell osd.0 injectargs -- '--osd_failsafe_full_ratio' >& $TMPFILE || return 1
-  check_response "Option --osd_failsafe_full_ratio requires an argument"
+  ceph tell osd.0 injectargs '--osd_enable_op_tracker --osd_op_history_duration 500' >& $TMPFILE || return 1
+  check_response "osd_enable_op_tracker = 'true' osd_op_history_duration = '500'"
+  ceph tell osd.0 injectargs --no-osd_enable_op_tracker >& $TMPFILE || return 1
+  check_response "osd_enable_op_tracker = 'false'"
+  ceph tell osd.0 injectargs -- --osd_enable_op_tracker >& $TMPFILE || return 1
+  check_response "osd_enable_op_tracker = 'true'"
+  ceph tell osd.0 injectargs -- '--osd_enable_op_tracker --osd_op_history_duration 600' >& $TMPFILE || return 1
+  check_response "osd_enable_op_tracker = 'true' osd_op_history_duration = '600'"
+  ceph tell osd.0 injectargs -- '--osd_op_history_duration' >& $TMPFILE || return 1
+  check_response "Option --osd_op_history_duration requires an argument"
+
+  ceph tell osd.0 injectargs -- '--mon-lease 6' >& $TMPFILE || return 1
+  check_response "mon_lease = '6' (unchangeable)"
 }
 
 function test_mon_injectargs_SI()
index 4ee54bb59adb9c59ff01bc3dadbf32850817a63f..2612c38537b9f18ca8b45575c53a8f0d87e3a24f 100644 (file)
@@ -590,13 +590,16 @@ void md_config_t::_apply_changes(std::ostream *oss)
   for (changed_set_t::const_iterator c = changed.begin();
        c != changed.end(); ++c) {
     const std::string &key(*c);
+    pair < obs_map_t::iterator, obs_map_t::iterator >
+      range(observers.equal_range(key));
     if ((oss) &&
        (!_get_val(key.c_str(), &bufptr, sizeof(buf))) &&
        !_internal_field(key)) {
       (*oss) << key << " = '" << buf << "' ";
+      if (range.first == range.second) {
+       (*oss) << "(unchangeable) ";
+      }
     }
-    pair < obs_map_t::iterator, obs_map_t::iterator >
-      range(observers.equal_range(key));
     for (obs_map_t::iterator r = range.first; r != range.second; ++r) {
       rev_obs_map_t::value_type robs_val(r->second, empty_set);
       pair < rev_obs_map_t::iterator, bool > robs_ret(robs.insert(robs_val));