"check whether removing the specified mon would break quorum",
"mon", "r")
-COMMAND_WITH_FLAG("heap " \
- "name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats", \
- "show heap usage info (available only if compiled with tcmalloc)", \
- "mon", "rw", FLAG(NOFORWARD))
COMMAND("tell " \
"name=target,type=CephName " \
"name=args,type=CephString,n=N", \
json_map[devid] = smart_json;
}
json_spirit::write(json_map, out, json_spirit::pretty_print);
+ } else if (command == "heap") {
+ if (!ceph_using_tcmalloc()) {
+ err << "could not issue heap profiler command -- not using tcmalloc!";
+ r = -EOPNOTSUPP;
+ goto abort;
+ }
+ string cmd;
+ if (!cmd_getval(cct, cmdmap, "heapcmd", cmd)) {
+ err << "unable to get value for command \"" << cmd << "\"";
+ r = -EINVAL;
+ goto abort;
+ }
+ std::vector<std::string> cmd_vec;
+ get_str_vec(cmd, cmd_vec);
+ string val;
+ if (cmd_getval(cct, cmdmap, "value", val)) {
+ cmd_vec.push_back(val);
+ }
+ ceph_heap_profiler_handle_command(cmd_vec, out);
} else {
ceph_abort_msg("bad AdminSocket command binding");
}
admin_hook,
"probe OSD devices for SMART data.");
ceph_assert(r == 0);
+ r = admin_socket->register_command(
+ "heap " \
+ "name=heapcmd,type=CephChoices,strings=" \
+ "dump|start_profiler|stop_profiler|release|get_release_rate|set_release_rate|stats " \
+ "name=value,type=CephString,req=false",
+ admin_hook,
+ "show heap usage info (available only if compiled with tcmalloc)");
+ ceph_assert(r == 0);
l.lock();
}
r = 0;
rs = "safe to remove mon." + id;
- } else if (prefix == "heap") {
- if (!ceph_using_tcmalloc())
- rs = "tcmalloc not enabled, can't use heap profiler commands\n";
- else {
- string heapcmd;
- cmd_getval(g_ceph_context, cmdmap, "heapcmd", heapcmd);
- // XXX 1-element vector, change at callee or make vector here?
- vector<string> heapcmd_vec;
- get_str_vec(heapcmd, heapcmd_vec);
- string value;
- if (cmd_getval(g_ceph_context, cmdmap, "value", value))
- heapcmd_vec.push_back(value);
- ceph_heap_profiler_handle_command(heapcmd_vec, ds);
- rdata.append(ds);
- rs = "";
- r = 0;
- }
} else if (prefix == "version") {
if (f) {
f->open_object_section("version");