From: Loic Dachary Date: Sat, 18 Mar 2017 09:04:20 +0000 (+0100) Subject: mon: osd crush set crushmap need sanity check X-Git-Tag: v12.0.2~157^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ed760457bf154c10adf75c6df046eecab7eb8e4b;p=ceph.git 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 1f6024f7d908..b6f1709f38e1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5900,18 +5900,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; } }