Merge pull request #367 from ceph/wip-ceph-cli

Reviewed-by: Dan Mick <dan.mick@inktank.com>
This commit is contained in:
Sage Weil 2013-06-19 20:02:27 -07:00
commit 1fccfd8b46
7 changed files with 19 additions and 7 deletions

View File

@ -1220,6 +1220,7 @@ def ceph_conf(field, name):
p = subprocess.Popen(
args=[
'ceph-conf',
'--show-config-value',
field,
'-n',
name,

View File

@ -156,7 +156,9 @@ int main(int argc, const char **argv)
argv_to_vec(argc, argv, args);
env_to_vec(args);
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_DAEMON,
CINIT_FLAG_NO_DAEMON_ACTIONS);
// do not common_init_finish(); do not start threads; do not do any of thing
// wonky things the daemon whose conf we are examining would do (like initialize

View File

@ -34,6 +34,9 @@ enum common_init_flags_t {
// Don't close stderr (in daemonize)
CINIT_FLAG_NO_CLOSE_STDERR = 0x4,
// don't do anything daemonish, like create /var/run/ceph, or print a banner
CINIT_FLAG_NO_DAEMON_ACTIONS = 0x8,
};
/*

View File

@ -120,7 +120,8 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const
g_ceph_context->_log->set_flush_on_exit();
if (g_conf->run_dir.length() &&
code_env == CODE_ENVIRONMENT_DAEMON) {
code_env == CODE_ENVIRONMENT_DAEMON &&
!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS)) {
int r = ::mkdir(g_conf->run_dir.c_str(), 0755);
if (r < 0 && errno != EEXIST) {
r = -errno;
@ -138,7 +139,7 @@ void global_init(std::vector < const char * > *alt_def_args, std::vector < const
// and opening the log file immediately.
conf->call_all_observers();
if (code_env == CODE_ENVIRONMENT_DAEMON)
if (code_env == CODE_ENVIRONMENT_DAEMON && !(flags & CINIT_FLAG_NO_DAEMON_ACTIONS))
output_ceph_version();
}

View File

@ -41,7 +41,7 @@ case "$1" in
fi
# is the socket defined? if it's not, this instance shouldn't run as a daemon.
rgw_socket=`ceph-conf -n $name 'rgw socket path'`
rgw_socket=`$RADOSGW -n $name --show-config-value rgw_socket_path`
if [ -z "$rgw_socket" ]; then
continue
fi
@ -57,7 +57,7 @@ case "$1" in
user="$DEFAULT_USER"
fi
log_file=`ceph-conf -n $name log_file`
log_file=`$RADOSGW -n $name --show-config-value log_file`
if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
touch "$log_file"
chown $user $log_file

View File

@ -43,7 +43,7 @@ case "$1" in
fi
# is the socket defined? if it's not, this instance shouldn't run as a daemon.
rgw_socket=`ceph-conf -n $name 'rgw socket path'`
rgw_socket=`$RADOSGW -n $name --show-config-value rgw_socket_path`
if [ -z "$rgw_socket" ]; then
continue
fi
@ -59,7 +59,7 @@ case "$1" in
user="$DEFAULT_USER"
fi
log_file=`ceph-conf -n $name log_file`
log_file=`$RADOSGW -n $name --show-config-value log_file`
if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
touch "$log_file"
chown $user $log_file

View File

@ -0,0 +1,5 @@
# should reflect daemon defaults
$ ceph-conf -n osd.0 --show-config-value log_file -c /dev/null
/var/log/ceph/ceph-osd.0.log