]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/DaemonServer: use process_pg_map_command helper for most things
authorSage Weil <sage@redhat.com>
Sat, 25 Feb 2017 03:25:39 +0000 (22:25 -0500)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 15:39:25 +0000 (11:39 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/DaemonServer.cc
src/mgr/MgrCommands.h

index 7d2e2abb2aff0e9a9a01905b7f2906c7066613b5..85eed18f55c8e48a61eb8ffece68b231f4543e78 100644 (file)
@@ -328,7 +328,19 @@ bool DaemonServer::handle_command(MCommand *m)
 #endif
     f.close_section(); // command_descriptions
     goto out;
-  } else {
+  }
+  else {
+    cluster_state.with_pgmap(
+      [&](const PGMap& pg_map) {
+       cluster_state.with_osdmap([&](const OSDMap& osdmap) {
+           r = process_pg_map_command(prefix, cmdmap, pg_map, osdmap,
+                                      f.get(), &ss, &odata);
+         });
+      });
+  }
+
+  // fall back to registered python handlers
+  if (r == -EOPNOTSUPP) {
     // Let's find you a handler!
     MgrPyModule *handler = nullptr;
     auto py_commands = py_modules.get_commands();
index e78b831f117480ab5e268fb76510c7eba6ad6129..6a407f4e66912af81a5aecf615a2f754c851b94c 100644 (file)
@@ -8,21 +8,18 @@
 COMMAND("pg stat", "show placement group status.",
        "pg", "r", "cli,rest")
 COMMAND("pg getmap", "get binary pg map to -o/stdout", "pg", "r", "cli,rest")
-COMMAND("pg dump " \
+
+COMMAND("pg dump "                                                     \
        "name=dumpcontents,type=CephChoices,strings=all|summary|sum|delta|pools|osds|pgs|pgs_brief,n=N,req=false", \
        "show human-readable versions of pg map (only 'all' valid with plain)", "pg", "r", "cli,rest")
-COMMAND("pg dump_json " \
+COMMAND("pg dump_json "                                                        \
        "name=dumpcontents,type=CephChoices,strings=all|summary|sum|pools|osds|pgs,n=N,req=false", \
        "show human-readable version of pg map in json only",\
        "pg", "r", "cli,rest")
 COMMAND("pg dump_pools_json", "show pg pools info in json only",\
        "pg", "r", "cli,rest")
-COMMAND("pg dump_stuck " \
-       "name=stuckops,type=CephChoices,strings=inactive|unclean|stale|undersized|degraded,n=N,req=false " \
-       "name=threshold,type=CephInt,req=false",
-       "show information about stuck pgs",\
-       "pg", "r", "cli,rest")
-COMMAND("pg ls-by-pool " \
+
+COMMAND("pg ls-by-pool "               \
         "name=poolstr,type=CephString " \
        "name=states,type=CephChoices,strings=active|clean|down|scrubbing|degraded|inconsistent|peering|repair|recovering|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized|activating|peered,n=N,req=false ", \
        "list pg with pool = [poolname]", "pg", "r", "cli,rest")
@@ -42,17 +39,18 @@ COMMAND("pg ls " \
        "list pg with specific pool, osd, state", "pg", "r", "cli,rest")
 COMMAND("pg map name=pgid,type=CephPgid", "show mapping of pg to osds", \
        "pg", "r", "cli,rest")
+COMMAND("pg dump_stuck " \
+       "name=stuckops,type=CephChoices,strings=inactive|unclean|stale|undersized|degraded,n=N,req=false " \
+       "name=threshold,type=CephInt,req=false",
+       "show information about stuck pgs",\
+       "pg", "r", "cli,rest")
+COMMAND("pg debug " \
+       "name=debugop,type=CephChoices,strings=unfound_objects_exist|degraded_pgs_exist", \
+       "show debug info about pgs", "pg", "r", "cli,rest")
+
 COMMAND("pg scrub name=pgid,type=CephPgid", "start scrub on <pgid>", \
        "pg", "rw", "cli,rest")
 COMMAND("pg deep-scrub name=pgid,type=CephPgid", "start deep-scrub on <pgid>", \
        "pg", "rw", "cli,rest")
 COMMAND("pg repair name=pgid,type=CephPgid", "start repair on <pgid>", \
        "pg", "rw", "cli,rest")
-COMMAND("pg debug " \
-       "name=debugop,type=CephChoices,strings=unfound_objects_exist|degraded_pgs_exist", \
-       "show debug info about pgs", "pg", "r", "cli,rest")
-COMMAND("pg set_full_ratio name=ratio,type=CephFloat,range=0.0|1.0", \
-       "set ratio at which pgs are considered full", "pg", "rw", "cli,rest")
-COMMAND("pg set_nearfull_ratio name=ratio,type=CephFloat,range=0.0|1.0", \
-       "set ratio at which pgs are considered nearly full", \
-       "pg", "rw", "cli,rest")