]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: test injected crush map
authorSage Weil <sage.weil@dreamhost.com>
Sun, 19 Feb 2012 22:50:15 +0000 (14:50 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Sun, 19 Feb 2012 22:50:15 +0000 (14:50 -0800)
Run a bunch of inputs through an injected crush map to make sure it isn't
broken.

Fixes: #1932
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mon/OSDMonitor.cc

index 139d5f943b922a80614d94db9e022acc7d4d4968..7ecf954e930e5c51f417ae3b03bce498a5b27f43 100644 (file)
@@ -20,6 +20,7 @@
 #include "MonitorStore.h"
 
 #include "crush/CrushWrapper.h"
+#include "crush/CrushTester.h"
 
 #include "messages/MOSDFailure.h"
 #include "messages/MOSDMap.h"
@@ -1524,6 +1525,13 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
        goto out;
       }
 
+      // sanity check: test some inputs to make sure this map isn't totally broken
+      dout(10) << " testing map" << dendl;
+      stringstream ess;
+      CrushTester tester(crush, ess, 1);
+      tester.test();
+      dout(10) << " result " << ess.str() << dendl;
+
       pending_inc.crush = data;
       string rs = "set crush map";
       paxos->wait_for_commit(new Monitor::C_Command(mon, m, 0, rs, paxos->get_version()));