]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add 'osd utilization' command
authorSage Weil <sage@redhat.com>
Wed, 2 Mar 2016 19:00:15 +0000 (14:00 -0500)
committerSage Weil <sage@redhat.com>
Thu, 10 Mar 2016 13:30:47 +0000 (08:30 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 5b757eff868dbce2393beadd9fe2522372288cc0)

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

index 6a48a603e3e3ec56da22ebdc8291396020ee76a0..e48bc4a9dd6fd0f1eecf2e050d8662304b36c77b 100644 (file)
@@ -654,6 +654,9 @@ COMMAND("osd pool stats " \
         "name=name,type=CephString,req=false",
         "obtain stats from all pools, or from specified pool",
         "osd", "r", "cli,rest")
+COMMAND("osd utilization",
+       "get basic pg distribution stats",
+       "osd", "r", "cli,rest")
 COMMAND("osd reweight-by-utilization " \
        "name=oload,type=CephInt,range=100,req=false " \
        "name=max_change,type=CephFloat,req=false "                     \
index 2d915c5814c32291682c5c1f01d3fd947543c043..2c8ab416a7f76857eda9442118607c378fd7bb5f 100644 (file)
@@ -2821,6 +2821,15 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
       ds << "max_osd = " << osdmap.get_max_osd() << " in epoch " << osdmap.get_epoch();
       rdata.append(ds);
     }
+  } else if (prefix == "osd utilization") {
+    string out;
+    osdmap.summarize_mapping_stats(NULL, NULL, &out, f.get());
+    if (f)
+      f->flush(rdata);
+    else
+      rdata.append(out);
+    r = 0;
+    goto reply;
   } else if (prefix  == "osd find") {
     int64_t osd;
     if (!cmd_getval(g_ceph_context, cmdmap, "id", osd)) {