]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make reweight-by-* max_change an argument
authorSage Weil <sage@redhat.com>
Thu, 3 Mar 2016 18:49:03 +0000 (13:49 -0500)
committerSage Weil <sage@redhat.com>
Thu, 10 Mar 2016 13:16:44 +0000 (08:16 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit a70eaabcfc1cc1dfb9b6ba2d7f71b3d76496eb55)

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

index b1bd720448f64deaf6a47d9e116d7ca521f9cbd2..1c313186e8797eb8c624dde83dcb5709b77996fe 100644 (file)
@@ -236,7 +236,6 @@ 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_osds, OPT_INT, 4)   // max osds to change per reweight-by-* 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 f3773b3d5a2fde3657ab280e5793533bae3b78f9..6a48a603e3e3ec56da22ebdc8291396020ee76a0 100644 (file)
@@ -656,12 +656,14 @@ COMMAND("osd pool stats " \
         "osd", "r", "cli,rest")
 COMMAND("osd reweight-by-utilization " \
        "name=oload,type=CephInt,range=100,req=false " \
+       "name=max_change,type=CephFloat,req=false "                     \
        "name=no_increasing,type=CephChoices,strings=--no-increasing,req=false " \
        "name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
        "reweight OSDs by utilization [overload-percentage-for-consideration, default 120]", \
        "osd", "rw", "cli,rest")
 COMMAND("osd reweight-by-pg " \
        "name=oload,type=CephInt,range=100,req=false " \
+       "name=max_change,type=CephFloat,req=false "                     \
        "name=no_increasing,type=CephChoices,strings=--no-increasing,req=false " \
        "name=pools,type=CephPoolname,n=N,req=false " \
        "name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
index 06d4e8a31a9370699de0634d565155b3a8acb492..2d915c5814c32291682c5c1f01d3fd947543c043 100644 (file)
@@ -468,6 +468,7 @@ void OSDMonitor::update_logger()
  */
 int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str,
                                        bool by_pg, const set<int64_t> *pools,
+                                       float max_change,
                                        bool no_increasing, bool sure)
 {
   if (oload <= 100) {
@@ -593,7 +594,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);
+      new_weight = MAX(new_weight, weight - max_change);
       if (sure) {
        pending_inc.new_weight[p->first] = new_weight;
        changed = true;
@@ -610,7 +611,7 @@ 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);
+      new_weight = MIN(new_weight, weight + max_change);
       if (new_weight > 0x10000)
           new_weight = 0x10000;
       if (new_weight > weight) {
@@ -6596,11 +6597,14 @@ done:
   } else if (prefix == "osd reweight-by-utilization") {
     int64_t oload;
     cmd_getval(g_ceph_context, cmdmap, "oload", oload, int64_t(120));
+    float max_change;
+    cmd_getval(g_ceph_context, cmdmap, "max_change", max_change);
     string no_increasing, sure;
     cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
     cmd_getval(g_ceph_context, cmdmap, "sure", sure);
     string out_str;
     err = reweight_by_utilization(oload, out_str, false, NULL,
+                                 max_change,
                                  no_increasing == "--no-increasing",
                                  sure == "--yes-i-really-mean-it");
     if (err < 0) {
@@ -6629,12 +6633,15 @@ done:
       }
       pools.insert(pool);
     }
+    float max_change;
+    cmd_getval(g_ceph_context, cmdmap, "max_change", max_change);
     string no_increasing, sure;
     cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
     cmd_getval(g_ceph_context, cmdmap, "sure", sure);
     string out_str;
     err = reweight_by_utilization(oload, out_str, true,
                                  pools.empty() ? NULL : &pools,
+                                 max_change,
                                  no_increasing == "--no-increasing",
                                  sure == "--yes-i-really-mean-it");
     if (err < 0) {
index 1f6e3f3ac4aa64a062041cd3501e9690e163c5ce..e64209c40029094ebb9713cdd68a65de1526bf5e 100644 (file)
@@ -218,7 +218,9 @@ private:
   void send_incremental(epoch_t first, MonSession *session, bool onetime);
 
   int reweight_by_utilization(int oload, std::string& out_str, bool by_pg,
-                             const set<int64_t> *pools, bool no_increasing,
+                             const set<int64_t> *pools,
+                             float max_change,
+                             bool no_increasing,
                              bool sure);
   void print_utilization(ostream &out, Formatter *f, bool tree) const;