From: Sage Weil Date: Fri, 5 Dec 2014 23:58:03 +0000 (-0800) Subject: mon: 'osd crush reweight-all' X-Git-Tag: v0.91~35^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89b2feea8d53b9dc15ab5ae7f5920ad19c8bba18;p=ceph.git mon: 'osd crush reweight-all' This corresponds to the crushtool --reweight command. Signed-off-by: Sage Weil --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 42a9326f47fb..3c7d1dc9d00a 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -813,6 +813,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 460b86cc8966..5d40293f87f6 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -448,6 +448,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 e1bdeda9392d..2055e93de59b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -4429,6 +4429,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") { // osd crush reweight CrushWrapper newcrush;