summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/config_opts.h2
-rw-r--r--src/mon/OSDMonitor.cc18
-rwxr-xr-xsrc/vstart.sh1
3 files changed, 13 insertions, 8 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index e79f4ad2b2a..8b4bf9d369a 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -190,6 +190,8 @@ OPTION(mon_slurp_bytes, OPT_INT, 256*1024) // limit size of slurp messages
OPTION(mon_client_bytes, OPT_U64, 100ul << 20) // client msg data allowed in memory (in bytes)
OPTION(mon_daemon_bytes, OPT_U64, 400ul << 20) // mds, osd message memory cap (in bytes)
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_health_data_update_interval, OPT_FLOAT, 60.0)
OPTION(mon_data_avail_crit, OPT_INT, 5)
OPTION(mon_data_avail_warn, OPT_INT, 30)
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 1b92f06ea7f..36502c833a0 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -487,7 +487,7 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str,
}
}
- if (num_pg_copies / num_osds < 10) {
+ if (num_pg_copies / num_osds < g_conf->mon_reweight_min_pgs_per_osd) {
ostringstream oss;
oss << "Refusing to reweight: we only have " << num_pg_copies
<< " PGs across " << num_osds << " osds!\n";
@@ -498,18 +498,20 @@ int OSDMonitor::reweight_by_utilization(int oload, std::string& out_str,
average_util = (double)num_pg_copies / weight_sum;
} else {
// by osd utilization
- if (pgm.osd_sum.kb < 1024) {
+ int num_osd = MIN(1, pgm.osd_stat.size());
+ if (pgm.osd_sum.kb * 1024 / num_osd
+ < g_conf->mon_reweight_min_bytes_per_osd) {
ostringstream oss;
- oss << "Refusing to reweight: we only have " << pgm.osd_sum << " kb "
- "across all osds!\n";
+ oss << "Refusing to reweight: we only have " << pgm.osd_sum.kb
+ << " kb across all osds!\n";
out_str = oss.str();
return -EDOM;
}
-
- if (pgm.osd_sum.kb_used < 5 * 1024) {
+ if (pgm.osd_sum.kb_used * 1024 / num_osd
+ < g_conf->mon_reweight_min_bytes_per_osd) {
ostringstream oss;
- oss << "Refusing to reweight: we only have " << pgm.osd_sum << " kb "
- "used across all osds!\n";
+ oss << "Refusing to reweight: we only have " << pgm.osd_sum.kb_used
+ << " kb used across all osds!\n";
out_str = oss.str();
return -EDOM;
}
diff --git a/src/vstart.sh b/src/vstart.sh
index cabd911a3ac..8b9fb9f13f7 100755
--- a/src/vstart.sh
+++ b/src/vstart.sh
@@ -394,6 +394,7 @@ $extra_conf
[mon]
mon pg warn min per osd = 10
mon osd allow primary affinity = true
+ mon reweight min pgs per osd = 4
$DAEMONOPTS
$CMONDEBUG
$extra_conf