Skip to content

Commit

Permalink
mon/OSDMonitor: remove ambiguous type case for 'osd pool set' value
Browse files Browse the repository at this point in the history
This was there for compatibility with very old monitors.  Modern mons are
always taking a JSON string (which may in turn contain a string, int, or
float).

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit efd9de4)

Conflicts:
	src/mon/OSDMonitor.cc
  • Loading branch information
liewegas authored and smithfarm committed Oct 2, 2018
1 parent 759c36e commit c838a00
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/mon/OSDMonitor.cc
Expand Up @@ -6448,17 +6448,12 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
int64_t n = 0;
double f = 0;
int64_t uf = 0; // micro-f
if (!cmd_getval(g_ceph_context, cmdmap, "val", val)) {
// wasn't a string; maybe an older mon forwarded json with an int?
if (!cmd_getval(g_ceph_context, cmdmap, "val", n))
return -EINVAL; // no value!
} else {
// we got a string. see if it contains an int.
n = strict_strtoll(val.c_str(), 10, &interr);
// or a float
f = strict_strtod(val.c_str(), &floaterr);
uf = llrintl(f * (double)1000000.0);
}
cmd_getval(g_ceph_context, cmdmap, "val", val);

// parse string as both int and float; different fields use different types.
n = strict_strtoll(val.c_str(), 10, &interr);
f = strict_strtod(val.c_str(), &floaterr);
uf = llrintl(f * (double)1000000.0);

if (!p.is_tier() &&
(var == "hit_set_type" || var == "hit_set_period" ||
Expand Down

0 comments on commit c838a00

Please sign in to comment.