return -ENOSYS;
}
+ bool show_config = false;
+ bool show_config_value = false;
+ string show_config_value_arg;
+
// In this function, don't change any parts of the configuration directly.
// Instead, use set_val to set them. This will allow us to send the proper
// observer notifications later.
_exit(0);
}
else if (ceph_argparse_flag(args, i, "--show_config", (char*)NULL)) {
- expand_all_meta();
- _show_config(&cout, NULL);
- _exit(0);
+ show_config = true;
}
else if (ceph_argparse_witharg(args, i, &val, "--show_config_value", (char*)NULL)) {
- char *buf = 0;
- int r = _get_val(val.c_str(), &buf, -1);
- if (r < 0) {
- if (r == -ENOENT)
- std::cerr << "failed to get config option '" << val << "': option not found" << std::endl;
- else
- std::cerr << "failed to get config option '" << val << "': " << strerror(-r) << std::endl;
- _exit(1);
- }
- string s = buf;
- expand_meta(s);
- std::cout << s << std::endl;
- _exit(0);
+ show_config_value = true;
+ show_config_value_arg = val;
}
else if (ceph_argparse_flag(args, i, "--foreground", "-f", (char*)NULL)) {
set_val_or_die("daemonize", "false");
parse_option(args, i, NULL);
}
}
+
+ if (show_config) {
+ expand_all_meta();
+ _show_config(&cout, NULL);
+ _exit(0);
+ }
+
+ if (show_config_value) {
+ char *buf = 0;
+ int r = _get_val(show_config_value_arg.c_str(), &buf, -1);
+ if (r < 0) {
+ if (r == -ENOENT)
+ std::cerr << "failed to get config option '" <<
+ show_config_value_arg << "': option not found" << std::endl;
+ else
+ std::cerr << "failed to get config option '" <<
+ show_config_value_arg << "': " << strerror(-r) << std::endl;
+ _exit(1);
+ }
+ string s = buf;
+ expand_meta(s);
+ std::cout << s << std::endl;
+ _exit(0);
+ }
+
return 0;
}
--- /dev/null
+ $ ceph-conf -n osd.0 --show-config -c /dev/null | grep ceph-osd
+ admin_socket = /var/run/ceph/ceph-osd.0.asok
+ log_file = /var/log/ceph/ceph-osd.0.log
+ mon_debug_dump_location = /var/log/ceph/ceph-osd.0.tdump
+ $ CEPH_ARGS="--fsid 96a3abe6-7552-4635-a79b-f3c096ff8b95" ceph-conf -n osd.0 --show-config -c /dev/null | grep fsid
+ fsid = 96a3abe6-7552-4635-a79b-f3c096ff8b95