From: Sage Weil Date: Wed, 4 Dec 2013 05:51:26 +0000 (-0800) Subject: osd/OSDMonitor: accept 'osd pool set ...' value as string X-Git-Tag: v0.67.5~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a447fb7d04fbad84f9ecb57726396bb6ca29d8f6;p=ceph.git osd/OSDMonitor: accept 'osd pool set ...' value as string 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 Reviewed-by: Greg Farnum --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 850bee05d275..897bbd3c2a40 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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)