From 85cefa113b31c9dc6b8a7a88e3343de923278c7d 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 1566069056209..fc8f0c8695887 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5697,18 +5697,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