From: Sage Weil Date: Tue, 19 Aug 2014 18:32:07 +0000 (-0700) Subject: mon: make reweight-by-* sanity limits configurable X-Git-Tag: v0.86~242^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2287%2Fhead;p=ceph.git mon: make reweight-by-* sanity limits configurable Also drop the somewhat redundant osd_sum.kb check; the main thing we care about here is Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index e79f4ad2b2ae..8b4bf9d369a3 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 1b92f06ea7f7..36502c833a05 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 cabd911a3ac9..8b9fb9f13f7b 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