From 10e6d1e1844ff20c6efde84ba8ecb9e779022ff7 Mon Sep 17 00:00:00 2001 From: Jesse Williamson Date: Tue, 20 Dec 2016 18:13:12 -0800 Subject: [PATCH] osd: changes "command" to "admin_command" for admin commands. Signed-off-by: Jesse Williamson --- src/osd/OSD.cc | 32 ++++++++++++++++---------------- src/osd/OSD.h | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 92d4e3a6a3cc..851de7899ea7 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1875,17 +1875,17 @@ public: bool call(std::string command, cmdmap_t& cmdmap, std::string format, bufferlist& out) override { stringstream ss; - bool r = osd->asok_command(command, cmdmap, format, ss); + bool r = osd->asok_command(admin_command, cmdmap, format, ss); out.append(ss); return r; } }; -bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, +bool OSD::asok_command(string admin_command, cmdmap_t& cmdmap, string format, ostream& ss) { Formatter *f = Formatter::create(format, "json-pretty", "json-pretty"); - if (command == "status") { + if (admin_command == "status") { f->open_object_section("status"); f->dump_stream("cluster_fsid") << superblock.cluster_fsid; f->dump_stream("osd_fsid") << superblock.osd_fsid; @@ -1898,15 +1898,15 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, f->dump_unsigned("num_pgs", pg_map.size()); } f->close_section(); - } else if (command == "flush_journal") { + } else if (admin_command == "flush_journal") { store->flush_journal(); - } else if (command == "dump_ops_in_flight" || - command == "ops") { + } else if (admin_command == "dump_ops_in_flight" || + admin_command == "ops") { if (!op_tracker.dump_ops_in_flight(f)) { ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } - } else if (command == "dump_blocked_ops") { + } else if (admin_command == "dump_blocked_ops") { if (!op_tracker.dump_ops_in_flight(f, true)) { ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; @@ -1921,11 +1921,11 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } - } else if (command == "dump_op_pq_state") { + } else if (admin_command == "dump_op_pq_state") { f->open_object_section("pq"); op_shardedwq.dump(f); f->close_section(); - } else if (command == "dump_blacklist") { + } else if (admin_command == "dump_blacklist") { list > bl; OSDMapRef curmap = service.get_osdmap(); @@ -1941,7 +1941,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, f->close_section(); //entry } f->close_section(); //blacklist - } else if (command == "dump_watchers") { + } else if (admin_command == "dump_watchers") { list watchers; // scan pg's { @@ -1984,7 +1984,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, } f->close_section(); //watchers - } else if (command == "dump_reservations") { + } else if (admin_command == "dump_reservations") { f->open_object_section("reservations"); f->open_object_section("local_reservations"); service.local_reserver.dump(f); @@ -1993,9 +1993,9 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, service.remote_reserver.dump(f); f->close_section(); f->close_section(); - } else if (command == "get_latest_osdmap") { + } else if (admin_command == "get_latest_osdmap") { get_latest_osdmap(); - } else if (command == "heap") { + } else if (admin_command == "heap") { auto result = ceph::osd_cmds::heap(*cct, cmdmap, *f, ss); // Note: Failed heap profile commands won't necessarily trigger an error: @@ -2003,7 +2003,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, f->dump_string("error", cpp_strerror(result)); f->dump_bool("success", result >= 0); f->close_section(); - } else if (command == "set_heap_property") { + } else if (admin_command == "set_heap_property") { string property; int64_t value = 0; string error; @@ -2027,7 +2027,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, f->dump_string("error", error); f->dump_bool("success", success); f->close_section(); - } else if (command == "get_heap_property") { + } else if (admin_command == "get_heap_property") { string property; size_t value = 0; string error; @@ -2050,7 +2050,7 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, store->get_db_statistics(f); } else if (command == "dump_scrubs") { service.dumps_scrub(f); - } else if (command == "calc_objectstore_db_histogram") { + } else if (admin_command == "calc_objectstore_db_histogram") { store->generate_db_histogram(f); } else if (command == "flush_store_cache") { store->flush_cache(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 7efcd376cb4a..f245236f3ead 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1307,7 +1307,7 @@ protected: // asok friend class OSDSocketHook; class OSDSocketHook *asok_hook; - bool asok_command(string command, cmdmap_t& cmdmap, string format, ostream& ss); + bool asok_command(string admin_command, cmdmap_t& cmdmap, string format, ostream& ss); public: ClassHandler *class_handler = nullptr; -- 2.47.3