Skip to content

Commit

Permalink
Merge pull request ceph#8840 from tchaikov/wip-opt-u32
Browse files Browse the repository at this point in the history
common/config: cast OPT_U32 options using uint32_t

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed May 20, 2016
2 parents 9278557 + b25ceb0 commit c46b4ca
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
12 changes: 9 additions & 3 deletions qa/workunits/cephtool/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,14 @@ function test_mon_injectargs()
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"
expect_failure $TMPDIR "Option --osd_op_history_duration requires an argument" \
ceph tell osd.0 injectargs -- '--osd_op_history_duration'

ceph tell osd.0 injectargs -- '--mon-lease 6' >& $TMPFILE || return 1
check_response "mon_lease = '6' (unchangeable)"

# 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
}

function test_mon_injectargs_SI()
Expand Down Expand Up @@ -228,6 +231,7 @@ function test_mon_injectargs_SI()
ceph tell mon.a injectargs '--mon_pg_warn_min_objects 1G'
expect_config_value "mon.a" "mon_pg_warn_min_objects" 1073741824
expect_false ceph tell mon.a injectargs '--mon_pg_warn_min_objects 10F'
expect_false ceph tell mon.a injectargs '--mon_globalid_prealloc -1'
$SUDO ceph daemon mon.a config set mon_pg_warn_min_objects $initial_value
}

Expand Down Expand Up @@ -734,6 +738,7 @@ function test_mds_tell()
for mds_gid in $old_mds_gids ; do
ceph tell mds.$mds_gid injectargs "--debug-mds 20"
done
expect_false ceph tell mds.a injectargs mds_max_file_recover -1

# Test respawn by rank
ceph tell mds.0 respawn
Expand Down Expand Up @@ -1673,11 +1678,12 @@ function test_osd_bench()
# max block size: 2097152 # 2MB
# duration: 10 # 10 seconds

ceph tell osd.0 injectargs "\
local args="\
--osd-bench-duration 10 \
--osd-bench-max-block-size 2097152 \
--osd-bench-large-size-max-throughput 10485760 \
--osd-bench-small-size-max-iops 10"
ceph tell osd.0 injectargs ${args## }

# anything with a bs larger than 2097152 must fail
expect_false ceph tell osd.0 bench 1 2097153
Expand Down
2 changes: 1 addition & 1 deletion src/common/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ int md_config_t::set_val_raw(const char *val, const config_option *opt)
return 0;
case OPT_U32: {
std::string err;
int f = strict_si_cast<int>(val, &err);
int f = strict_si_cast<uint32_t>(val, &err);
if (!err.empty())
return -EINVAL;
*(uint32_t*)opt->conf_ptr(this) = f;
Expand Down
3 changes: 1 addition & 2 deletions src/common/strtol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,9 @@ T strict_si_cast(const char *str, std::string *err)
}

template int strict_si_cast<int>(const char *str, std::string *err);

template long long strict_si_cast<long long>(const char *str, std::string *err);

template uint64_t strict_si_cast<uint64_t>(const char *str, std::string *err);
template uint32_t strict_si_cast<uint32_t>(const char *str, std::string *err);

uint64_t strict_sistrtoll(const char *str, std::string *err)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDSDaemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ int MDSDaemon::_handle_command(
string args = argsvec.front();
for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a)
args += " " + *a;
cct->_conf->injectargs(args, &ss);
r = cct->_conf->injectargs(args, &ss);
} else if (prefix == "exit") {
// We will send response before executing
ss << "Exiting...";
Expand Down
2 changes: 1 addition & 1 deletion src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5463,7 +5463,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a)
args += " " + *a;
osd_lock.Unlock();
cct->_conf->injectargs(args, &ss);
r = cct->_conf->injectargs(args, &ss);
osd_lock.Lock();
}
else if (prefix == "cluster_log") {
Expand Down

0 comments on commit c46b4ca

Please sign in to comment.