summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-20 08:49:48 -0700
committerSage Weil <sage@inktank.com>2013-07-20 08:49:48 -0700
commitc3acc256088a3da36c964d149263058ec647b6b2 (patch)
treebc114b274b18b4e91a853dfb3a59647782e00207
parent7e25fecdfeb3d558fcffcbcff64615d16cc83800 (diff)
downloadceph-c3acc256088a3da36c964d149263058ec647b6b2.tar.gz
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 <sage@inktank.com>
-rw-r--r--src/ceph_mds.cc3
-rw-r--r--src/ceph_mon.cc3
-rw-r--r--src/ceph_osd.cc3
-rw-r--r--src/common/config_opts.h2
4 files changed, 11 insertions, 0 deletions
diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc
index a8b4519d4b2..88b807b1b24 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 f247de8cdfb..35ed56a7985 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 49cae9dddb8..d8590bff817 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 defb71ee514..ed44dca145d 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.