flags, "mon_data");
ceph_heap_profiler_init();
- uuid_d fsid;
std::string val;
for (std::vector<const char*>::iterator i = args.begin(); i != args.end(); ) {
if (ceph_argparse_double_dash(args, i)) {
MonMap monmap;
// load or generate monmap
- if (g_conf->monmap.length()) {
- int err = monmapbl.read_file(g_conf->monmap.c_str(), &error);
+ const auto monmap_fn = g_conf->get_val<string>("monmap");
+ if (monmap_fn.length()) {
+ int err = monmapbl.read_file(monmap_fn.c_str(), &error);
if (err < 0) {
- derr << argv[0] << ": error reading " << g_conf->monmap << ": " << error << dendl;
+ derr << argv[0] << ": error reading " << monmap_fn << ": " << error << dendl;
exit(1);
}
try {
// always mark seed/mkfs monmap as epoch 0
monmap.set_epoch(0);
- }
- catch (const buffer::error& e) {
- derr << argv[0] << ": error decoding monmap " << g_conf->monmap << ": " << e.what() << dendl;
+ } catch (const buffer::error& e) {
+ derr << argv[0] << ": error decoding monmap " << monmap_fn << ": " << e.what() << dendl;
exit(1);
}
} else {
}
}
- if (!g_conf->fsid.is_zero()) {
- monmap.fsid = g_conf->fsid;
- dout(0) << argv[0] << ": set fsid to " << g_conf->fsid << dendl;
+ const auto fsid = g_conf->get_val<uuid_d>("fsid");
+ if (!fsid.is_zero()) {
+ monmap.fsid = fsid;
+ dout(0) << argv[0] << ": set fsid to " << fsid << dendl;
}
if (monmap.fsid.is_zero()) {
return r;
}
- fsid = cct->_conf->fsid;
+ fsid = cct->_conf->get_val<uuid_d>("fsid");
host = cct->_conf->host;
return 0;
}
}
if (log->graylog() && changed.count("fsid")) {
- log->graylog()->set_fsid(conf->fsid);
+ log->graylog()->set_fsid(conf->get_val<uuid_d>("fsid"));
}
}
};
/* note: no header guard */
OPTION(host, OPT_STR) // "" means that ceph will use short hostname
-OPTION(fsid, OPT_UUID)
OPTION(public_addr, OPT_ADDR)
OPTION(public_bind_addr, OPT_ADDR)
OPTION(cluster_addr, OPT_ADDR)
OPTION(public_network, OPT_STR)
OPTION(cluster_network, OPT_STR)
-OPTION(monmap, OPT_STR)
-OPTION(mon_host, OPT_STR)
OPTION(lockdep, OPT_BOOL)
OPTION(lockdep_force_backtrace, OPT_BOOL) // always gather current backtrace at every lock
OPTION(run_dir, OPT_STR) // the "/var/run/ceph" dir, created on daemon startup
if (graylogs.count(channel) == 0) {
auto graylog(std::make_shared<ceph::logging::Graylog>("mon"));
- graylog->set_fsid(g_conf->fsid);
+ graylog->set_fsid(g_conf->get_val<uuid_d>("fsid"));
graylog->set_hostname(g_conf->host);
graylog->set_destination(get_str_map_key(log_to_graylog_host, channel,
&CLOG_CONFIG_DEFAULT_KEY),
{
const md_config_t *conf = cct->_conf;
// file?
- if (!conf->monmap.empty()) {
+ const auto monmap = conf->get_val<std::string>("monmap");
+ if (!monmap.empty()) {
int r;
try {
- r = read(conf->monmap.c_str());
+ r = read(monmap.c_str());
}
catch (const buffer::error &e) {
r = -EINVAL;
}
if (r >= 0)
return 0;
- errout << "unable to read/decode monmap from " << conf->monmap
+ errout << "unable to read/decode monmap from " << monmap
<< ": " << cpp_strerror(-r) << std::endl;
return r;
}
// fsid from conf?
- if (!cct->_conf->fsid.is_zero()) {
- fsid = cct->_conf->fsid;
+ const auto new_fsid = conf->get_val<uuid_d>("fsid");
+ if (!new_fsid.is_zero()) {
+ fsid = new_fsid;
}
// -m foo?
- if (!conf->mon_host.empty()) {
- int r = build_from_host_list(conf->mon_host, "noname-");
+ const auto mon_host = conf->get_val<std::string>("mon_host");
+ if (!mon_host.empty()) {
+ int r = build_from_host_list(mon_host, "noname-");
if (r < 0) {
- errout << "unable to parse addrs in '" << conf->mon_host << "'"
+ errout << "unable to parse addrs in '" << mon_host << "'"
<< std::endl;
return r;
}
monmap.created = ceph_clock_now();
monmap.last_changed = monmap.created;
srand(getpid() + time(0));
- if (g_conf->fsid.is_zero()) {
+ if (g_conf->get_val<uuid_d>("fsid").is_zero()) {
monmap.generate_fsid();
cout << me << ": generated fsid " << monmap.fsid << std::endl;
}
modified = true;
}
- if (!g_conf->fsid.is_zero()) {
- monmap.fsid = g_conf->fsid;
+ if (!g_conf->get_val<uuid_d>("fsid").is_zero()) {
+ monmap.fsid = g_conf->get_val<uuid_d>("fsid");
cout << me << ": set fsid to " << monmap.fsid << std::endl;
modified = true;
}