]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmaptool: fail --import-crush if crush max_devices > osdmap max_osd
authorSage Weil <sage@newdream.net>
Sat, 21 May 2011 19:55:16 +0000 (12:55 -0700)
committerSage Weil <sage@newdream.net>
Sat, 21 May 2011 19:55:16 +0000 (12:55 -0700)
Crush will spew non-deterministic badness if it walks off the end of
the osd_weight vector.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osdmaptool.cc

index a494453e29a5230f878a7146e26fe5089b180ab2..a0d0b42a760bb8dc68f73cefb4667e338571a14f 100644 (file)
@@ -159,10 +159,17 @@ int main(int argc, const char **argv)
       cerr << me << ": error reading crush map from " << import_crush << std::endl;
       exit(1);
     }
+
     // validate
     CrushWrapper cw;
     bufferlist::iterator p = cbl.begin();
     cw.decode(p);
+
+    if (cw.get_max_devices() > osdmap.get_max_osd()) {
+      cerr << me << ": crushmap max_devices " << cw.get_max_devices()
+          << " > osdmap max_osd " << osdmap.get_max_osd() << std::endl;
+      exit(1);
+    }
     
     // apply
     OSDMap::Incremental inc;