Formatter *f = new_formatter(format);
if (!f)
f = new_formatter("json-pretty");
- if (command == "dump_ops_in_flight") {
+ if (command == "status") {
+ f->open_object_section("status");
+ f->dump_stream("cluster_fsid") << superblock.cluster_fsid;
+ f->dump_stream("osd_fsid") << superblock.osd_fsid;
+ f->dump_unsigned("whoami", superblock.whoami);
+ f->dump_string("state", get_state_name(state));
+ f->dump_unsigned("oldest_map", superblock.oldest_map);
+ f->dump_unsigned("newest_map", superblock.newest_map);
+ osd_lock.Lock();
+ f->dump_unsigned("num_pgs", pg_map.size());
+ osd_lock.Unlock();
+ f->close_section();
+ } else if (command == "dump_ops_in_flight") {
op_tracker.dump_ops_in_flight(f);
} else if (command == "dump_historic_ops") {
op_tracker.dump_historic_ops(f);
int r;
AdminSocket *admin_socket = cct->get_admin_socket();
asok_hook = new OSDSocketHook(this);
+ r = admin_socket->register_command("status", "status", asok_hook,
+ "high-level status of OSD");
+ assert(r == 0);
r = admin_socket->register_command("dump_ops_in_flight",
"dump_ops_in_flight", asok_hook,
"show the ops currently in flight");
}
// unregister commands
+ cct->get_admin_socket()->unregister_command("status");
cct->get_admin_socket()->unregister_command("dump_ops_in_flight");
cct->get_admin_socket()->unregister_command("dump_historic_ops");
cct->get_admin_socket()->unregister_command("dump_op_pq_state");
static const int STATE_STOPPING = 4;
static const int STATE_WAITING_FOR_HEALTHY = 5;
+ static const char *get_state_name(int s) {
+ switch (s) {
+ case STATE_INITIALIZING: return "initializing";
+ case STATE_BOOTING: return "booting";
+ case STATE_ACTIVE: return "active";
+ case STATE_STOPPING: return "stopping";
+ case STATE_WAITING_FOR_HEALTHY: return "waiting_for_healthy";
+ default: return "???";
+ }
+ }
+
private:
int state;
epoch_t boot_epoch; // _first_ epoch we were marked up (after this process started)