]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ceph_context: add "assert" and "abort" asok commands
authorSage Weil <sage@redhat.com>
Fri, 15 Jun 2018 22:29:11 +0000 (17:29 -0500)
committerDan Mick <dan.mick@redhat.com>
Mon, 15 Oct 2018 23:45:52 +0000 (16:45 -0700)
Require 'debug_asok_assert_abort = true'

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 14699d2997f8b1e6e65cc2c24b33e2fcaf9cee4d)

src/common/ceph_context.cc
src/common/legacy_config_opts.h
src/common/options.cc
src/vstart.sh

index 5fee784edae9fd4b5fa88c28de8b58ea342e9c50..014741b276fe6ff22737a828fcbc1f0d3b0eca38 100644 (file)
@@ -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");
index f375e210ce90f6fe38b98a432ef5bc6f0f6c22c7..c05e7d10a95c2af65c275a71986c10cafc6965ea 100644 (file)
@@ -1513,6 +1513,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
 
index 9e567b6f438a2da229b4d851f41d6a7eafd7df45..22adf6a7a368a7377b553e7ae0b374828264aeb5 100644 (file)
@@ -4864,6 +4864,10 @@ std::vector<Option> get_global_options() {
     Option("debug_asserts_on_shutdown", Option::TYPE_BOOL,Option::LEVEL_DEV)
     .set_default(false)
     .set_description("Enable certain asserts to check for refcounting bugs on shutdown; see http://tracker.ceph.com/issues/21738"),
+
+    Option("debug_asok_assert_abort", Option::TYPE_BOOL, Option::LEVEL_DEV)
+    .set_default(false)
+    .set_description("allow commands 'assert' and 'abort' via asok for testing crash dumps etc"),
   });
 }
 
index 84e84e4c19ae063137158e0993c3efc149244ada..9b4af13d86cb71735e4a8dab91f7d350c2c6a742 100755 (executable)
@@ -461,6 +461,7 @@ prepare_conf() {
        crash dir = $CEPH_OUT_DIR
         enable experimental unrecoverable data corrupting features = *
        osd_crush_chooseleaf_type = 0
+       debug asok assert abort = true
 $extra_conf
 EOF
        if [ "$lockdep" -eq 1 ] ; then