]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: 'osd crush reweight-all'
authorSage Weil <sage@redhat.com>
Fri, 5 Dec 2014 23:58:03 +0000 (15:58 -0800)
committerSage Weil <sage@redhat.com>
Fri, 13 Feb 2015 16:32:00 +0000 (08:32 -0800)
This corresponds to the crushtool --reweight command.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 89b2feea8d53b9dc15ab5ae7f5920ad19c8bba18)

qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 46f6a94dcf60cc9dfa680b28a92e36921d74d554..c40a2fda01d11010877710517f24adb84508026f 100755 (executable)
@@ -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
index f5af54eb014ea2e77015f50e021a1680ef6ae795..461b3f29e0ac776104979fbed3e83de39aa8c853 100644 (file)
@@ -425,6 +425,9 @@ COMMAND("osd crush unlink " \
        "name=ancestor,type=CephString,req=false,goodchars=[A-Za-z0-9-_.]", \
        "unlink <name> from crush map (everywhere, or just at <ancestor>)", \
        "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", \
index 18428229430f6d9087277987de86a3f5653d4bc1..da06b86beb1d49193111ca8ae193d3b33b7c7df3 100644 (file)
@@ -4167,6 +4167,19 @@ bool OSDMonitor::prepare_command_impl(MMonCommand *m,
       }
     } while (false);
 
+  } else if (prefix == "osd crush reweight-all") {
+    // osd crush reweight <name> <weight>
+    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 <name> <weight>