summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-19 20:02:27 -0700
committerSage Weil <sage@inktank.com>2013-06-19 20:02:27 -0700
commit1fccfd8b46f5788130dfeba67528bc0e5fc9330b (patch)
tree4c1c48d73302d96aec46b7d74fbcf4116a914857
parent84444d0be69d433f880ffe7f3a9b863043d1db5b (diff)
parent021158306ef4ab82cf07684ce81e5c0d90817300 (diff)
downloadceph-1fccfd8b46f5788130dfeba67528bc0e5fc9330b.tar.gz
Merge pull request #367 from ceph/wip-ceph-cli
Reviewed-by: Dan Mick <dan.mick@inktank.com>
-rwxr-xr-xsrc/ceph.in1
-rw-r--r--src/ceph_conf.cc4
-rw-r--r--src/common/common_init.h3
-rw-r--r--src/global/global_init.cc5
-rw-r--r--src/init-radosgw4
-rw-r--r--src/init-radosgw.sysv4
-rw-r--r--src/test/cli/ceph-conf/show-config-value.t5
7 files changed, 19 insertions, 7 deletions
diff --git a/src/ceph.in b/src/ceph.in
index bec3558b588..46b735f4806 100755
--- a/src/ceph.in
+++ b/src/ceph.in
@@ -1220,6 +1220,7 @@ def ceph_conf(field, name):
p = subprocess.Popen(
args=[
'ceph-conf',
+ '--show-config-value',
field,
'-n',
name,
diff --git a/src/ceph_conf.cc b/src/ceph_conf.cc
index 608c0852122..b2286f4e094 100644
--- a/src/ceph_conf.cc
+++ b/src/ceph_conf.cc
@@ -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
diff --git a/src/common/common_init.h b/src/common/common_init.h
index 3dfd12915f4..f48b349bf00 100644
--- a/src/common/common_init.h
+++ b/src/common/common_init.h
@@ -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,
};
/*
diff --git a/src/global/global_init.cc b/src/global/global_init.cc
index 8363d0e191a..e96c317f820 100644
--- a/src/global/global_init.cc
+++ b/src/global/global_init.cc
@@ -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();
}
diff --git a/src/init-radosgw b/src/init-radosgw
index 174620fa9eb..a526441c3a0 100644
--- a/src/init-radosgw
+++ b/src/init-radosgw
@@ -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
diff --git a/src/init-radosgw.sysv b/src/init-radosgw.sysv
index ed9d178d7a8..da80ae19be8 100644
--- a/src/init-radosgw.sysv
+++ b/src/init-radosgw.sysv
@@ -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
diff --git a/src/test/cli/ceph-conf/show-config-value.t b/src/test/cli/ceph-conf/show-config-value.t
new file mode 100644
index 00000000000..03d7ed8e086
--- /dev/null
+++ b/src/test/cli/ceph-conf/show-config-value.t
@@ -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