Commit Graph

45 Commits

Author SHA1 Message Date
Sage Weil
0a2ec988f1 config: add 'fatal signal handlers' option
This will let us disable the sighandlers for SEGV, etc.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-27 14:57:35 -07:00
Sage Weil
cca85af5b0 global: only print banner if type is daemon
Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-14 14:59:36 -07:00
Sage Weil
1eea43db19 global: fix version banner in log on startup
Log banner from global_init().  This puts it at the very top of the log,
right when the daemon starts.

Fixes: #2940
Signed-off-by: Sage Weil <sage@inktank.com>
2012-08-14 14:06:47 -07:00
Sage Weil
d61269402d config: send warnings to a ostream* argument
We shouldn't always send these to stderr.  (Among other things, the
warning: prefix breaks the gitbuilder error detection.)

Signed-off-by: Sage Weil <sage@inktank.com>
2012-07-28 07:39:27 -07:00
Sage Weil
e50932c204 global_init: do not count threads before daemonize()
We were verifying that there was only 1 thread (the presumably main()) when
we call daemonize.  However, with the new logging code, we stop a thread
right before the check, and /proc apparently updates asynchronously such
that our attempt to count running threads gives us a bad answer.

Just remove this kludgey check; we'll have to catch this class of bugs
the hard way.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-05-03 20:00:36 -07:00
Greg Farnum
ccfb6b3a86 global_init: don't fail out if there is no default config.
There are plenty of scenarios where the user doesn't need a config file.
Instead, just print a warning and let things move on.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
2012-04-30 15:06:17 -07:00
Greg Farnum
845718d9fb global: fix incorrect CINIT flag.
There is nobody responding to CLOSE_STDERR, but this block sure looks
like it should be doing so. Fix that!

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
2012-04-30 14:10:35 -07:00
Sage Weil
c4c59a094d log: do not set on_exit() callback for libraries
Set this up in either global_init() or common_init_finish(), both opportune
times that occur after config parsing has happened and the user has the
option to modify this behavior.  The exception would be libraries like
librados, which can't use rados_conf_* to enable this.  Arguably flush
functionality should be exposed through the librados API directly, instead
of futzing with on_exit().

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-04-28 16:27:22 -07:00
Sage Weil
2c0dc47e22 global: add -C or --cluster early args to specify cluster name
This will let you specify which cluster to talk to on the command line
(e.g., 'ceph -C foo ...' or when starting a daemon).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-04-05 13:32:38 -07:00
Sage Weil
2878865463 log: dump_recent in fatal signal handler
Signed-off-by: Sage Weil <sage@newdream.net>
2012-03-30 16:11:31 -07:00
Sage Weil
f41887e38d log: new logging infrastructure
- explicitly defined subsystems, and ceph_subsys_FOO enums to go with them
- modular log system with Entry object
- separate gather level and log level
- drop lots of DoutStreambuf hackery

Signed-off-by: Sage Weil <sage@newdream.net>
2012-03-27 10:41:12 -07:00
Yehuda Sadeh
e0b8f7a033 rgw: process default alt args before processing conf file
this fixes #2189

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
2012-03-20 10:52:14 -07:00
Sage Weil
e6969258c4 global: drop yellow warning on startup
Fixes: #2143
Signed-off-by: Sage Weil <sage@newdream.net>
2012-03-13 13:48:53 -07:00
Yehuda Sadeh
2c88f85c6d config: alternative config options for global_init()
We want to be able to provide alternative default config values, than
the ones we set in common/config_opts.h. This can be useful when we
want different default for different modules (e.g., rgw, rgw-admin).
Just passing it on the command line won't do because then we'd override
any config set by the user, so we need to process that before the regular
parsing (but after initializing the config context).

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
2012-03-12 13:21:22 -07:00
Sage Weil
722e9e59cb lockdep: don't make noise on startup
Who cares!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-02-24 12:40:34 -08:00
Sage Weil
6403852426 lockdep: warn on stderr (via derr), not stdout
Otherwise we screw up ceph-conf output and the like.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-02-24 11:15:12 -08:00
Sage Weil
0b7f6e397c global: resurrect lockdep
Add 'lockdep' config option, and initialize g_lockdep from that in
global_init().

Signed-off-by: Sage Weil <sage@newdream.net>
2012-02-20 14:38:20 -08:00
Sage Weil
2aafdeada8 signals: check write(2) return values
Signed-off-by: Sage Weil <sage@newdream.net>
2012-02-14 21:04:05 -08:00
Sage Weil
afa1f9e392 signal: remove unused/obsolete handle_shutdown_signal
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-02-14 21:03:53 -08:00
Sage Weil
7951315580 signals: do not install default SIGHUP, SIGINT, SIGTERM handlers
These should be app specific and async.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-02-14 21:03:53 -08:00
Sage Weil
ecd280253a signals: implement safe async signal handler framework
Based on http://evbergen.home.xs4all.nl/unix-signals.html.

Instead of his design, though, we write single bytes, and create a pipe per
signal we have handlers registered for.

Signed-off-by: Sage Weil <sage@newdream.net>
2012-02-14 21:03:53 -08:00
Sage Weil
e43db381a2 signal: use _exit() on SIGTERM
No need to call onexit handlers, static dtors, whatever.

This may help with #1996 and #1549.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2012-01-28 09:26:46 -08:00
Sage Weil
d1dbeaf59d exit(0) on SIGTERM by default
Signed-off-by: Sage Weil <sage@newdream.net>
2011-12-21 14:17:00 -08:00
Sage Weil
f6ee3699c9 global: make daemon banner print explicit
This eliminates some flags and avoids annoying cases where the banner is
printed but we don't want to see it.

Signed-off-by: Sage Weil <sage@newdream.net>
2011-12-01 09:17:51 -08:00
Sage Weil
46f330d01c Merge branch 'master' into wip-freebsd 2011-10-25 14:54:16 -07:00
Sage Weil
0aa40ea06e assert: no 0x before thread id
There's no 0x prefix in the log lines either.  This makes it easier to
copy/paste word and search.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-10-19 21:14:13 -07:00
Stanislav Sedov
9fde4d946f First cut of FreeBSD support. This patch allowes ceph to compile successfully
under FreeBSD.

Signed-off-by:	Stanislav Sedov <stas@FreeBSD.org>
2011-10-04 17:34:41 -07:00
Sage Weil
3b645fb975 common: CINIT_FLAG_NO_BANNER
Signed-off-by: Sage Weil <sage@newdream.net>
2011-10-04 16:02:47 -07:00
Sage Weil
3714862123 global_init: make startup line consistent, less ugly
Signed-off-by: Sage Weil <sage@newdream.net>
2011-08-31 10:00:51 -07:00
Colin Patrick McCabe
8072bdcaa4 Fix bug in turning off logging. Remove log_dir.
Fix a bug that made it impossible to turn off logging to a file.

Remove the old "log_dir" setting. It has been deprecated for a long
time, and it adds a lot of complexity to the code.

heap_profiler: use the directory that log_file is in to construct a
profiler output file name. Don't use log_dir.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-08-15 20:58:23 -07:00
Colin Patrick McCabe
498dd53729 injectargs: print out what is changing
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-07-28 14:49:18 -07:00
Colin Patrick McCabe
1cf5211e72 Rename ProfLogger to PerfCounters
Part 1: file names

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-07-20 15:58:13 -07:00
Colin Patrick McCabe
1da8f8177a honor CINIT_FLAG_NO_DEFAULT_CONFIG_FILE
Don't use CEPH_CONF_FILE_DEFAULT when CINIT_FLAG_NO_DEFAULT_CONFIG_FILE
is set.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-07-05 14:56:59 -07:00
Colin Patrick McCabe
ca6d239083 Fix handling of CEPH_CONF
Formerly, CEPH_CONF was not respected by libraries. But now it is.
It overrides the default when reading the config file.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-30 14:43:01 -07:00
Colin Patrick McCabe
13909c2423 global_init: make global_init_set_globals static
Now that the libraries have been de-globalized, this funtion should only
be used by global_init itself.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-24 14:30:36 -07:00
Colin Patrick McCabe
80df03d8ec push global_init_set_globals into preinit callers
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-23 13:39:49 -07:00
Colin Patrick McCabe
c9cf19c5ce Remove "#include debug.h" from config.h
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-22 14:49:56 -07:00
Colin Patrick McCabe
df2e3bcb2a initialize g_ceph_context in common_preinit
Initialize g_ceph_context in common_preinit rather than in a global
constructor.

Add comments to all of the major initialization functions.

We still set globals in common_preinit, for the time being.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-21 16:23:37 -07:00
Colin Patrick McCabe
112e569296 Convert g_ceph_context to a pointer.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-21 12:28:16 -07:00
Colin Patrick McCabe
b02c8d6545 Create test_libcommon_build
Create test_libcommon_build to test for references to g_ceph_context and
other libglobal symbols from within libcommon.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-21 11:40:20 -07:00
Colin Patrick McCabe
fbf3f4ac2e common_init: de-globalize
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-21 11:40:20 -07:00
Colin Patrick McCabe
83020ad03f assert: de-globalize
Implement a simple registration system so that assert output can still
show up non-interleaved in daemons and utilities. Library code will just
use dout_emergency, which is simple and deadlock-free, but might be
interleaved with ongoing messages sometimes.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-20 16:41:43 -07:00
Colin Patrick McCabe
fc43438601 Create global_context.cc to house g_ceph_context
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-20 16:41:42 -07:00
Colin Patrick McCabe
6ff09ef541 Move signal, pidfile to global
Move the global parts of signal and pidfile handling into global/

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-20 16:41:42 -07:00
Colin Patrick McCabe
63bbadddb0 move common_init to global_init
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-20 16:37:34 -07:00