]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make reweight-by-* sanity limits configurable 2287/head
authorSage Weil <sage@redhat.com>
Tue, 19 Aug 2014 18:32:07 +0000 (11:32 -0700)
committerSage Weil <sage@redhat.com>
Tue, 19 Aug 2014 18:32:07 +0000 (11:32 -0700)
Also drop the somewhat redundant osd_sum.kb check; the main thing we care
about here is

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc
src/vstart.sh

index e79f4ad2b2ae5e5d44b14f1a4f5b90113ba5c817..8b4bf9d369a3ba1097807edc8f6f43577cf5999d 100644 (file)
@@ -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)
index 1b92f06ea7f730dd9add2ac366faef6e115aec84..36502c833a0575e5c43381f9f4dadf54b73666d1 100644 (file)
@@ -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;
     }
index cabd911a3ac945a7a95c705a6f219ac9a9ef8497..8b9fb9f13f7b273010d842a2a27be0d56d852fca 100755 (executable)
@@ -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