From 14699d2997f8b1e6e65cc2c24b33e2fcaf9cee4d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 15 Jun 2018 17:29:11 -0500 Subject: [PATCH] common/ceph_context: add "assert" and "abort" asok commands Require 'debug_asok_assert_abort = true' Signed-off-by: Sage Weil --- src/common/ceph_context.cc | 8 ++++++++ src/common/legacy_config_opts.h | 1 + src/common/options.cc | 4 ++++ src/vstart.sh | 1 + 4 files changed, 14 insertions(+) diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index faaca450b2d..0a087d8cc24 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -391,6 +391,12 @@ void CephContext::do_command(std::string_view command, const cmdmap_t& cmdmap, } lgeneric_dout(this, 1) << "do_command '" << command << "' '" << ss.str() << dendl; + if (command == "assert" && _conf->debug_asok_assert_abort) { + assert(0 == "assert"); + } + if (command == "abort" && _conf->debug_asok_assert_abort) { + abort(); + } if (command == "perfcounters_dump" || command == "1" || command == "perf dump") { std::string logger; @@ -582,6 +588,8 @@ CephContext::CephContext(uint32_t module_type_, _plugin_registry = new PluginRegistry(this); _admin_hook = new CephContextHook(this); + _admin_socket->register_command("assert", "assert", _admin_hook, ""); + _admin_socket->register_command("abort", "abort", _admin_hook, ""); _admin_socket->register_command("perfcounters_dump", "perfcounters_dump", _admin_hook, ""); _admin_socket->register_command("1", "1", _admin_hook, ""); _admin_socket->register_command("perf dump", "perf dump name=logger,type=CephString,req=false name=counter,type=CephString,req=false", _admin_hook, "dump perfcounters value"); diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index 1df4177884a..b7c1559cdd0 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1516,6 +1516,7 @@ OPTION(rgw_torrent_sha_unit, OPT_INT) // torrent field piece length 512K OPTION(event_tracing, OPT_BOOL) // true if LTTng-UST tracepoints should be enabled OPTION(debug_deliberately_leak_memory, OPT_BOOL) +OPTION(debug_asok_assert_abort, OPT_BOOL) OPTION(rgw_swift_custom_header, OPT_STR) // option to enable swift custom headers diff --git a/src/common/options.cc b/src/common/options.cc index a4c54a19b7f..e682526a7c9 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -4880,6 +4880,10 @@ std::vector