From: Yanhu Cao Date: Tue, 13 Jun 2017 02:34:10 +0000 (+0800) Subject: common,config: OPT_FLOAT and OPT_DOUBLE output format in "config show" X-Git-Tag: v12.1.1~157^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=26cb1537c07d020395ee75bb419defef200ecc5a;p=ceph.git common,config: OPT_FLOAT and OPT_DOUBLE output format in "config show" Fixes: http://tracker.ceph.com/issues/20104 Signed-off-by: Yanhu Cao --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 9612fda6f663..dda15c882c90 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -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 diff --git a/src/common/config.cc b/src/common/config.cc index fd6ab3441da5..563f72e056a8 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -926,6 +926,10 @@ int md_config_t::_get_val(const char *key, std::string *value) const { ostringstream oss; if (bool *flag = boost::get(&config_value)) { oss << (*flag ? "true" : "false"); + } else if (float *fp = boost::get(&config_value)) { + oss << std::fixed << *fp ; + } else if (double *dp = boost::get(&config_value)) { + oss << std::fixed << *dp ; } else { oss << config_value; }