From: Sage Weil Date: Fri, 5 Dec 2014 23:58:03 +0000 (-0800) Subject: mon: 'osd crush reweight-all' X-Git-Tag: v0.80.9~11^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f6009a614a3689cc9a96f55b35e70362be4ec64b;p=ceph.git mon: 'osd crush reweight-all' This corresponds to the crushtool --reweight command. Signed-off-by: Sage Weil (cherry picked from commit 89b2feea8d53b9dc15ab5ae7f5920ad19c8bba18) --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 46f6a94dcf6..c40a2fda01d 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -421,6 +421,7 @@ function test_mon_osd() # # osd crush # + ceph osd crush reweight-all ceph osd crush tunables legacy ceph osd crush show-tunables | grep argonaut ceph osd crush tunables bobtail diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index f5af54eb014..461b3f29e0a 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -425,6 +425,9 @@ COMMAND("osd crush unlink " \ "name=ancestor,type=CephString,req=false,goodchars=[A-Za-z0-9-_.]", \ "unlink from crush map (everywhere, or just at )", \ "osd", "rw", "cli,rest") +COMMAND("osd crush reweight-all", + "recalculate the weights for the tree to ensure they sum correctly", + "osd", "rw", "cli,rest") COMMAND("osd crush reweight " \ "name=name,type=CephString,goodchars=[A-Za-z0-9-_.] " \ "name=weight,type=CephFloat,range=0.0", \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 18428229430..da06b86beb1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -4167,6 +4167,19 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m, } } while (false); + } else if (prefix == "osd crush reweight-all") { + // osd crush reweight + CrushWrapper newcrush; + _get_pending_crush(newcrush); + + newcrush.reweight(g_ceph_context); + pending_inc.crush.clear(); + newcrush.encode(pending_inc.crush); + ss << "reweighted crush hierarchy"; + getline(ss, rs); + wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, rs, + get_last_committed() + 1)); + return true; } else if (prefix == "osd crush reweight") { do { // osd crush reweight