From: Sage Weil Date: Sat, 20 Jul 2013 15:49:48 +0000 (-0700) Subject: mon, mds, osd: add early SIGTERM injection X-Git-Tag: v0.67-rc2~19^2~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3acc256088a3da36c964d149263058ec647b6b2;p=ceph.git mon, mds, osd: add early SIGTERM injection This makes it easy to identify problems with (early) shutdown with a loop like while [ ! -e core ] ; do ./ceph-mds -i a -c ceph.conf -f ; done and a vstart cluster. Signed-off-by: Sage Weil --- diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc index a8b4519d4b29..88b807b1b245 100644 --- a/src/ceph_mds.cc +++ b/src/ceph_mds.cc @@ -294,6 +294,9 @@ int main(int argc, const char **argv) register_async_signal_handler_oneshot(SIGINT, handle_mds_signal); register_async_signal_handler_oneshot(SIGTERM, handle_mds_signal); + if (g_conf->inject_early_sigterm) + kill(getpid(), SIGTERM); + messenger->wait(); unregister_async_signal_handler(SIGHUP, sighup_handler); diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index f247de8cdfb5..35ed56a7985b 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -552,6 +552,9 @@ int main(int argc, const char **argv) register_async_signal_handler_oneshot(SIGINT, handle_mon_signal); register_async_signal_handler_oneshot(SIGTERM, handle_mon_signal); + if (g_conf->inject_early_sigterm) + kill(getpid(), SIGTERM); + messenger->wait(); unregister_async_signal_handler(SIGHUP, sighup_handler); diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index 49cae9dddb88..d8590bff8175 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -465,6 +465,9 @@ int main(int argc, const char **argv) register_async_signal_handler_oneshot(SIGINT, handle_osd_signal); register_async_signal_handler_oneshot(SIGTERM, handle_osd_signal); + if (g_conf->inject_early_sigterm) + kill(getpid(), SIGTERM); + client_messenger->wait(); messenger_hbclient->wait(); messenger_hb_front_server->wait(); diff --git a/src/common/config_opts.h b/src/common/config_opts.h index defb71ee514c..ed44dca145d9 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -123,6 +123,8 @@ OPTION(ms_inject_delay_max, OPT_DOUBLE, 1) // seconds OPTION(ms_inject_delay_probability, OPT_DOUBLE, 0) // range [0, 1] OPTION(ms_inject_internal_delays, OPT_DOUBLE, 0) // seconds +OPTION(inject_early_sigterm, OPT_BOOL, false) + OPTION(mon_data, OPT_STR, "/var/lib/ceph/mon/$cluster-$id") OPTION(mon_initial_members, OPT_STR, "") // list of initial cluster mon ids; if specified, need majority to form initial quorum and create new cluster OPTION(mon_sync_fs_threshold, OPT_INT, 5) // sync() when writing this many objects; 0 to disable.