]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: osd crush set crushmap need sanity check 16144/head
authorLoic Dachary <ldachary@redhat.com>
Sat, 18 Mar 2017 09:04:20 +0000 (10:04 +0100)
committerNathan Cutler <ncutler@suse.com>
Thu, 31 Aug 2017 20:14:33 +0000 (22:14 +0200)
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 <loic@dachary.org>
(cherry picked from commit ed760457bf154c10adf75c6df046eecab7eb8e4b)

src/mon/OSDMonitor.cc

index cce35c58fcb7189739c01829024b0857a399b2ad..de7e0fef35b7fb88dd8c9f9d38bfb95a2a82dcc8 100644 (file)
@@ -5536,18 +5536,16 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       goto reply;
     }
     
-    if (prefix == "osd setcrushmap") {
-      const map<int64_t,pg_pool_t> &osdmap_pools = osdmap.get_pools();
-      map<int64_t,pg_pool_t>::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<int64_t,pg_pool_t> &osdmap_pools = osdmap.get_pools();
+    map<int64_t,pg_pool_t>::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;
       }
     }