From a447fb7d04fbad84f9ecb57726396bb6ca29d8f6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 3 Dec 2013 21:51:26 -0800 Subject: [PATCH] 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 --- src/mon/OSDMonitor.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 850bee05d275f..897bbd3c2a408 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) -- 2.39.5