]> 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, 10 Mar 2016 13:30:47 +0000 (08:30 -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>
(cherry picked from commit 651f05b6e6bec41b54c0a8f8ca6641ce3aa5dff3)

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

index 2cdbc2a4151dcdb36dd824318161d161c5dfbc1c..46fbe6d82da90df32fbfb1951213b54265e84f1c 100644 (file)
@@ -660,24 +660,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 f6ea1fbc6b2bbcc05490661eee9c8fc0960f9709..7b275f4773435f87f99aa260ef13832e7ad09cb1 100644 (file)
@@ -475,6 +475,7 @@ struct Sorter {
  */
 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,
@@ -562,11 +563,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);
@@ -630,7 +633,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) {
@@ -651,7 +654,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;
       }
     }
@@ -6673,11 +6676,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 6fa4a6af4d254dc1c7a1401118449b61da75d8e0..d8a3e1fa4575e926a1adbe482a2565b0d0d739a7 100644 (file)
@@ -219,6 +219,7 @@ private:
 
   int reweight_by_utilization(int oload,
                              double max_change,
+                             int max_osds,
                              bool by_pg,
                              const set<int64_t> *pools,
                              bool no_increasing,