]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: remove ambiguous type case for 'osd pool set' value 23243/head
authorSage Weil <sage@redhat.com>
Fri, 3 Aug 2018 17:20:48 +0000 (12:20 -0500)
committerSage Weil <sage@redhat.com>
Sun, 5 Aug 2018 02:55:07 +0000 (21:55 -0500)
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>
src/mon/OSDMonitor.cc

index da684505fb880b65acab01c60adac8eb9e22996e..3eb2bf424edcc5cd34dd9c68a099cda841be32c8 100644 (file)
@@ -6672,17 +6672,12 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
   int64_t n = 0;
   double f = 0;
   int64_t uf = 0;  // micro-f
-  if (!cmd_getval(cct, cmdmap, "val", val)) {
-    // wasn't a string; maybe an older mon forwarded json with an int?
-    if (!cmd_getval(cct, 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(cct, 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" ||