]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMonitor: accept 'osd pool set ...' value as string
authorSage Weil <sage@inktank.com>
Wed, 4 Dec 2013 05:51:26 +0000 (21:51 -0800)
committerGreg Farnum <greg@inktank.com>
Wed, 11 Dec 2013 21:37:12 +0000 (13:37 -0800)
Newer monitors take this as a CephString.  Accept that so that if we are
mid-upgrade and get a forwarded message using the alternate schema from
a future mon we will handle it properly.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mon/OSDMonitor.cc

index 850bee05d275f5b43ca3557deb6705e0a35124a9..897bbd3c2a4081bcb0709cb3dea6fc7544a613d8 100644 (file)
@@ -3521,7 +3521,23 @@ done:
     } else {
       const pg_pool_t *p = osdmap.get_pg_pool(pool);
       int64_t n;
-      cmd_getval(g_ceph_context, cmdmap, "val", n);
+      if (!cmd_getval(g_ceph_context, cmdmap, "val", n)) {
+       // try to get it as a string.  this is a kludge for forward
+       // compatibility for future json schemas that pass 'val' as a
+       // string.
+       string val;
+       if (!cmd_getval(g_ceph_context, cmdmap, "val", val)) {
+         err = -EINVAL;
+         goto reply;
+       }
+       string interr;
+       n = strict_strtoll(val.c_str(), 10, &interr);
+       if (interr.length()) {
+         ss << interr;
+         err = -EINVAL;
+         goto reply;
+       }
+      }
       string var;
       cmd_getval(g_ceph_context, cmdmap, "var", var);
       if (pending_inc.new_pools.count(pool) == 0)