From d90b1b339542408fb053571b64e705be208cb3be Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 18 Mar 2017 10:04:20 +0100 Subject: [PATCH] mon: osd crush set crushmap need sanity check The sanity check verifying the new crushmap does not remove crush rules that are in use is not exclusive to ceph setcrushmap. Fixes: http://tracker.ceph.com/issues/19302 Signed-off-by: Loic Dachary (cherry picked from commit ed760457bf154c10adf75c6df046eecab7eb8e4b) --- src/mon/OSDMonitor.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index cce35c58fcb71..de7e0fef35b7f 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5536,18 +5536,16 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } - if (prefix == "osd setcrushmap") { - const map &osdmap_pools = osdmap.get_pools(); - map::const_iterator pit; - for (pit = osdmap_pools.begin(); pit != osdmap_pools.end(); ++pit) { - const int64_t pool_id = pit->first; - const pg_pool_t &pool = pit->second; - int ruleno = pool.get_crush_ruleset(); - if (!crush.rule_exists(ruleno)) { - ss << " the crush rule no "<< ruleno << " for pool id " << pool_id << " is in use"; - err = -EINVAL; - goto reply; - } + const map &osdmap_pools = osdmap.get_pools(); + map::const_iterator pit; + for (pit = osdmap_pools.begin(); pit != osdmap_pools.end(); ++pit) { + const int64_t pool_id = pit->first; + const pg_pool_t &pool = pit->second; + int ruleno = pool.get_crush_ruleset(); + if (!crush.rule_exists(ruleno)) { + ss << " the crush rule no "<< ruleno << " for pool id " << pool_id << " is in use"; + err = -EINVAL; + goto reply; } } -- 2.39.5