]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: 'osd crush reweight-all' 3057/head
authorSage Weil <sage@redhat.com>
Fri, 5 Dec 2014 23:58:03 +0000 (15:58 -0800)
committerSage Weil <sage@redhat.com>
Wed, 10 Dec 2014 00:09:26 +0000 (16:09 -0800)
This corresponds to the crushtool --reweight command.

Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 42a9326f47fbe549205492a669e66ada3de0dec2..3c7d1dc9d00aa5b6ffeb644960fcfe60fd9bab7f 100755 (executable)
@@ -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
index 460b86cc896640478be32ee596c2f58349071da9..5d40293f87f6fb97d842b1d0ea2542abb3e7b711 100644 (file)
@@ -448,6 +448,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 e1bdeda9392dd382c85f824a236d2e3cd14201cb..2055e93de59b695a9c2687f6ddfe2cbfcdb5cfa2 100644 (file)
@@ -4429,6 +4429,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") {
     // osd crush reweight <name> <weight>
     CrushWrapper newcrush;