]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add mon_reweight_max_change option which limits reweight-by-*
authorDan van der Ster <daniel.vanderster@cern.ch>
Fri, 26 Feb 2016 21:28:46 +0000 (22:28 +0100)
committerSage Weil <sage@redhat.com>
Thu, 10 Mar 2016 13:16:39 +0000 (08:16 -0500)
Add a configurable mon_reweight_max_change which limits be default
the reweight-by-* commands to only change an OSDs weight by 0.05.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
(cherry picked from commit 6f0a1fb69da84ee18bdb9b151772cef8f32413c5)

src/common/config_opts.h
src/mon/OSDMonitor.cc

index 76763e4ee9bde39545684088e4f1ee67a9e6bc38..0671b594e66e748af054d62015ec0f3462f1e6c5 100644 (file)
@@ -235,6 +235,7 @@ OPTION(mon_daemon_bytes, OPT_U64, 400ul << 20)  // mds, osd message memory cap (
 OPTION(mon_max_log_entries_per_event, OPT_INT, 4096)
 OPTION(mon_reweight_min_pgs_per_osd, OPT_U64, 10)   // min pgs per osd for reweight-by-pg command
 OPTION(mon_reweight_min_bytes_per_osd, OPT_U64, 100*1024*1024)   // min bytes per osd for reweight-by-utilization command
+OPTION(mon_reweight_max_change, OPT_FLOAT, 0.05)   // max change to each osd per reweight-by-* command
 OPTION(mon_health_data_update_interval, OPT_FLOAT, 60.0)
 OPTION(mon_health_to_clog, OPT_BOOL, true)
 OPTION(mon_health_to_clog_interval, OPT_INT, 3600)
index 1d394ba6e49a03a0f040164815f5b0bcd937440c..c6bce4f5b62fce693293ac9781e741deb8e79916 100644 (file)
@@ -574,6 +574,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str,
       // to represent e.g. differing storage capacities
       unsigned weight = osdmap.get_weight(p->first);
       unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
+      new_weight = MAX(new_weight, weight - g_conf->mon_reweight_max_change);
       if (sure) {
        pending_inc.new_weight[p->first] = new_weight;
        changed = true;
@@ -588,8 +589,9 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str,
       // assign a higher weight.. if we can.
       unsigned weight = osdmap.get_weight(p->first);
       unsigned new_weight = (unsigned)((average_util / util) * (float)weight);
+      new_weight = MIN(new_weight, weight + g_conf->mon_reweight_max_change);
       if (new_weight > 0x10000)
-       new_weight = 0x10000;
+          new_weight = 0x10000;
       if (new_weight > weight) {
        sep = ", ";
        if (sure) {