]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common,config: OPT_FLOAT and OPT_DOUBLE output format in "config show" 15647/head
authorYanhu Cao <gmayyyha@gmail.com>
Tue, 13 Jun 2017 02:34:10 +0000 (10:34 +0800)
committerYanhu Cao <gmayyyha@gmail.com>
Thu, 15 Jun 2017 02:51:02 +0000 (10:51 +0800)
Fixes: http://tracker.ceph.com/issues/20104
Signed-off-by: Yanhu Cao <gmayyyha@gmail.com>
qa/workunits/cephtool/test.sh
src/common/config.cc

index 9612fda6f663c98a3bdf99879d8454017f93fd88..dda15c882c90d8de9a7fe7f610e02e82e0503a97 100755 (executable)
@@ -215,11 +215,18 @@ function test_mon_injectargs()
   expect_failure $TEMP_DIR "Option --osd_op_history_duration requires an argument" \
                  ceph tell osd.0 injectargs -- '--osd_op_history_duration'
 
+  ceph tell osd.0 injectargs -- '--osd_deep_scrub_interval 2419200' >& $TMPFILE || return 1
+  check_response "osd_deep_scrub_interval = '2419200.000000' (not observed, change may require restart)"
+
+  ceph tell osd.0 injectargs -- '--mon_probe_timeout 2' >& $TMPFILE || return 1
+  check_response "mon_probe_timeout = '2.000000' (not observed, change may require restart)"
+
   ceph tell osd.0 injectargs -- '--mon-lease 6' >& $TMPFILE || return 1
-  check_response "mon_lease = '6' (not observed, change may require restart)"
+  check_response "mon_lease = '6.000000' (not observed, change may require restart)"
 
   # osd-scrub-auto-repair-num-errors is an OPT_U32, so -1 is not a valid setting
-  expect_false ceph tell osd.0 injectargs --osd-scrub-auto-repair-num-errors -1
+  expect_false ceph tell osd.0 injectargs --osd-scrub-auto-repair-num-errors -1 >& $TMPFILE || return 1
+  check_response "Error EINVAL: Parse error setting osd_scrub_auto_repair_num_errors to '-1' using injectargs"
 }
 
 function test_mon_injectargs_SI()
@@ -2180,6 +2187,7 @@ function test_mon_crushmap_validation()
   check_response "Error EINVAL: Failed crushmap test: TEST FAIL"
 
   local mon_lease=`ceph-conf --show-config-value mon_lease`
+  mon_lease=`echo ${mon_lease} | awk '{ printf $1 + 0 }'`
 
   test "${mon_lease}" -gt 0
 
index fd6ab3441da5614a1de901da2e4e6b98e7514fc5..563f72e056a8185f8d6142571e3539e97326b5aa 100644 (file)
@@ -926,6 +926,10 @@ int md_config_t::_get_val(const char *key, std::string *value) const {
     ostringstream oss;
     if (bool *flag = boost::get<bool>(&config_value)) {
       oss << (*flag ? "true" : "false");
+    } else if (float *fp = boost::get<float>(&config_value)) {
+      oss << std::fixed << *fp ;
+    } else if (double *dp = boost::get<double>(&config_value)) {
+      oss << std::fixed << *dp ;
     } else {
       oss << config_value;
     }