*
*/
+#include "include/compat.h"
+#include "common/common_init.h"
#include "common/admin_socket.h"
#include "common/ceph_argparse.h"
-#include "common/common_init.h"
+#include "common/ceph_context.h"
+#include "common/config.h"
+#include "common/dout.h"
+#include "common/strtol.h"
#include "common/valgrind.h"
#include "common/zipkin_trace.h"
#define _STR(x) #x
#define STRINGIFY(x) _STR(x)
+#ifndef WITH_SEASTAR
CephContext *common_preinit(const CephInitParameters &iparams,
enum code_environment_t code_env, int flags)
{
// Create a configuration object
CephContext *cct = new CephContext(iparams.module_type, code_env, flags);
- md_config_t *conf = cct->_conf;
+ auto& conf = cct->_conf;
// add config observers here
// Set up our entity name.
// for backward compatibility. moving forward, we want all keyrings
// in these locations. the mon already forces $mon_data/keyring.
if (conf->name.is_mds()) {
- conf->set_val("keyring", "$mds_data/keyring", false);
+ conf.set_val_default("keyring", "$mds_data/keyring");
} else if (conf->name.is_osd()) {
- conf->set_val("keyring", "$osd_data/keyring", false);
+ conf.set_val_default("keyring", "$osd_data/keyring");
+ }
+
+ if ((flags & CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS)) {
+ // make this unique despite multiple instances by the same name.
+ conf.set_val_default("admin_socket",
+ "$run_dir/$cluster-$name.$pid.$cctid.asok");
}
if (code_env == CODE_ENVIRONMENT_LIBRARY ||
code_env == CODE_ENVIRONMENT_UTILITY_NODOUT) {
- conf->set_val_or_die("log_to_stderr", "false");
- conf->set_val_or_die("err_to_stderr", "false");
- conf->set_val_or_die("log_flush_on_exit", "false");
- }
- if (code_env != CODE_ENVIRONMENT_DAEMON) {
- // NOTE: disable ms subsystem gathering in clients by default
- conf->set_val_or_die("debug_ms", "0/0");
+ conf.set_val_default("log_to_stderr", "false");
+ conf.set_val_default("err_to_stderr", "false");
+ conf.set_val_default("log_flush_on_exit", "false");
}
return cct;
}
+#endif // #ifndef WITH_SEASTAR
void complain_about_parse_errors(CephContext *cct,
std::deque<std::string> *parse_errors)
}
}
+#ifndef WITH_SEASTAR
+
/* Please be sure that this can safely be called multiple times by the
* same application. */
void common_init_finish(CephContext *cct)
{
+ // only do this once per cct
+ if (cct->_finished) {
+ return;
+ }
+ cct->_finished = true;
cct->init_crypto();
ZTracer::ztrace_init();
+ if (!cct->_log->is_started()) {
+ cct->_log->start();
+ }
+
int flags = cct->get_init_flags();
if (!(flags & CINIT_FLAG_NO_DAEMON_ACTIONS))
cct->start_service_thread();
cct->get_admin_socket()->chown(cct->get_set_uid(), cct->get_set_gid());
}
- md_config_t *conf = cct->_conf;
+ const auto& conf = cct->_conf;
if (!conf->admin_socket.empty() && !conf->admin_socket_mode.empty()) {
int ret = 0;
}
}
}
+
+#endif // #ifndef WITH_SEASTAR