]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Unifies heap command for OSD console and admin interface.
authorJesse Williamson <jwilliamson@suse.de>
Tue, 6 Dec 2016 22:04:55 +0000 (14:04 -0800)
committerJesse Williamson <jwilliamson@suse.de>
Fri, 31 Mar 2017 08:22:59 +0000 (01:22 -0700)
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
src/osd/OSD.cc
src/osd/OSD.h

index 05bee9f4893e7448eb54429da3fbdb950d606a0c..92d4e3a6a3cc2da88412a86aaf86f0cc55290043 100644 (file)
@@ -1562,6 +1562,14 @@ void OSDService::queue_for_snap_trim(PG *pg)
 #undef dout_prefix
 #define dout_prefix *_dout
 
+// Commands shared between OSD's console and admin console:
+namespace ceph { 
+namespace osd_cmds { 
+
+int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os);
+}} // namespace ceph::osd_cmds
+
 int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
              uuid_d fsid, int whoami)
 {
@@ -1988,7 +1996,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format,
   } else if (command == "get_latest_osdmap") {
     get_latest_osdmap();
   } else if (command == "heap") {
-    auto result = ceph::osd_cmds::admin::heap(*cct, cmdmap, *f, ss);
+    auto result = ceph::osd_cmds::heap(*cct, cmdmap, *f, ss);
 
     // Note: Failed heap profile commands won't necessarily trigger an error:
     f->open_object_section("result");
@@ -6024,17 +6032,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
   }
 
   else if (prefix == "heap") {
-    if (!ceph_using_tcmalloc()) {
-      r = -EOPNOTSUPP;
-      ss << "could not issue heap profiler command -- not using tcmalloc!";
-    } else {
-      string heapcmd;
-      cmd_getval(cct, cmdmap, "heapcmd", heapcmd);
-      // XXX 1-element vector, change at callee or make vector here?
-      vector<string> heapcmd_vec;
-      get_str_vec(heapcmd, heapcmd_vec);
-      ceph_heap_profiler_handle_command(heapcmd_vec, ds);
-    }
+    r = ceph::osd_cmds::heap(*cct, cmdmap, *f, ds);
   }
 
   else if (prefix == "debug dump_missing") {
@@ -9560,7 +9558,6 @@ void OSD::ShardedOpWQ::_enqueue_front(pair<spg_t, PGQueueable> item)
 
 namespace ceph { 
 namespace osd_cmds { 
-namespace admin {
 
 int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os)
 {
@@ -9584,5 +9581,5 @@ int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os)
   return 0;
 }
  
-}}} // namespace ceph::osd::admin_commands
+}} // namespace ceph::osd_cmds
 
index 0076526a4bd2e77a5fba4c388b7198655c728492..7efcd376cb4af6185a0da447f46bffafaa616702 100644 (file)
@@ -2452,13 +2452,4 @@ extern const CompatSet::Feature ceph_osd_feature_compat[];
 extern const CompatSet::Feature ceph_osd_feature_ro_compat[];
 extern const CompatSet::Feature ceph_osd_feature_incompat[];
 
-namespace ceph { 
-namespace osd_cmds { 
-namespace admin {
-
-int heap(CephContext& cct, cmdmap_t& cmdmap, Formatter& f, std::ostream& os);
-}}} // namespace ceph::osd_cmds::admin
-
-
 #endif