]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: make max_osds an optional arg
authorSage Weil <sage@redhat.com>
Thu, 3 Mar 2016 18:46:12 +0000 (13:46 -0500)
committerSage Weil <sage@redhat.com>
Thu, 3 Mar 2016 18:49:06 +0000 (13:49 -0500)
We keep the config option with the default (4), but let you
specify the max # of osds to reweight as a third optional arg.

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

index 58b4d1d89469858ba0d86ff97bc9b383496b190d..a1287dfafce22ce0ab383ec8939a0aa83be28682 100644 (file)
@@ -707,24 +707,28 @@ COMMAND("osd utilization",
 COMMAND("osd reweight-by-utilization " \
        "name=oload,type=CephInt,range=100,req=false " \
        "name=max_change,type=CephFloat,req=false "                     \
+       "name=max_osds,type=CephInt,req=false "                 \
        "name=no_increasing,type=CephChoices,strings=--no-increasing,req=false",\
        "reweight OSDs by utilization [overload-percentage-for-consideration, default 120]", \
        "osd", "rw", "cli,rest")
 COMMAND("osd test-reweight-by-utilization " \
        "name=oload,type=CephInt,range=100,req=false " \
        "name=max_change,type=CephFloat,req=false "                     \
+       "name=max_osds,type=CephInt,req=false "                 \
        "name=no_increasing,type=CephChoices,strings=--no-increasing,req=false",\
        "dry run of 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=max_osds,type=CephInt,req=false "                 \
        "name=pools,type=CephPoolname,n=N,req=false",                   \
        "reweight OSDs by PG distribution [overload-percentage-for-consideration, default 120]", \
        "osd", "rw", "cli,rest")
 COMMAND("osd test-reweight-by-pg " \
        "name=oload,type=CephInt,range=100,req=false " \
        "name=max_change,type=CephFloat,req=false "                     \
+       "name=max_osds,type=CephInt,req=false "                 \
        "name=pools,type=CephPoolname,n=N,req=false",                   \
        "dry run of reweight OSDs by PG distribution [overload-percentage-for-consideration, default 120]", \
        "osd", "rw", "cli,rest")
index 6a22f991768234bf0795ed069ade959aadce548d..f6bff252c78d1ecc04de3d119cada69eae4452c4 100644 (file)
@@ -480,6 +480,7 @@ void OSDMonitor::update_logger()
  */
 int OSDMonitor::reweight_by_utilization(int oload,
                                        double max_changef,
+                                       int max_osds,
                                        bool by_pg, const set<int64_t> *pools,
                                        bool no_increasing,
                                        bool dry_run,
@@ -567,11 +568,13 @@ int OSDMonitor::reweight_by_utilization(int oload,
     f->open_object_section("reweight_by_utilization");
     f->dump_unsigned("overload_min", oload);
     f->dump_float("max_change", max_changef);
+    f->dump_float("max_change_osds", max_osds);
     f->dump_float("average_utilization", average_util);
     f->dump_float("overload_utilization", overload_util);
   } else {
     oss << "oload " << oload << "\n";
     oss << "max_change " << max_changef << "\n";
+    oss << "max_change_osds " << max_osds << "\n";
     char buf[128];
     snprintf(buf, sizeof(buf), "average %04f\noverload %04f\n",
             average_util, overload_util);
@@ -637,7 +640,7 @@ int OSDMonitor::reweight_by_utilization(int oload,
                 (float)new_weight / (float)0x10000);
        oss << buf;
       }
-      if (++num_changed >= g_conf->mon_reweight_max_osds)
+      if (++num_changed >= max_osds)
        break;
     }
     if (!no_increasing && util <= underload_util) {
@@ -658,7 +661,7 @@ int OSDMonitor::reweight_by_utilization(int oload,
                 (float)weight / (float)0x10000,
                 (float)new_weight / (float)0x10000);
        oss << buf;
-       if (++num_changed >= g_conf->mon_reweight_max_osds)
+       if (++num_changed >= max_osds)
          break;
       }
     }
@@ -7523,11 +7526,14 @@ done:
       err = -EINVAL;
       goto reply;
     }
+    int64_t max_osds = g_conf->mon_reweight_max_osds;
+    cmd_getval(g_ceph_context, cmdmap, "max_osds", max_osds);
     string no_increasing;
     cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing);
     string out_str;
     err = reweight_by_utilization(oload,
                                  max_change,
+                                 max_osds,
                                  by_pg,
                                  pools.empty() ? NULL : &pools,
                                  no_increasing == "--no-increasing",
index 85489f5427d53776c87dca72c0788dd73aa8a330..9d4d33d239bf8f5fcb2c39c37e8e2ccd6a57d910 100644 (file)
@@ -230,6 +230,7 @@ public:
 private:
   int reweight_by_utilization(int oload,
                              double max_change,
+                             int max_osds,
                              bool by_pg,
                              const set<int64_t> *pools,
                              bool no_increasing,