mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
config: parse fsid uuid in config, not ceph_mon
Use the new OPT_UUID type. Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
parent
2c14c8b206
commit
cfee0333e7
@ -174,13 +174,9 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!g_conf->fsid.empty()) {
|
||||
if (!monmap.fsid.parse(g_conf->fsid.c_str())) {
|
||||
cerr << "unable to parse fsid '" << g_conf->fsid << "'" << std::endl;
|
||||
exit(1);
|
||||
} else {
|
||||
cout << argv[0] << ": set fsid to " << g_conf->fsid << std::endl;
|
||||
}
|
||||
if (!g_conf->fsid.is_zero()) {
|
||||
monmap.fsid = g_conf->fsid;
|
||||
cout << argv[0] << ": set fsid to " << g_conf->fsid << std::endl;
|
||||
}
|
||||
|
||||
if (monmap.fsid.is_zero()) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
/* note: no header guard */
|
||||
OPTION(host, OPT_STR, "localhost")
|
||||
OPTION(fsid, OPT_STR, "") // used for mkfs
|
||||
OPTION(fsid, OPT_UUID, uuid_d())
|
||||
OPTION(public_addr, OPT_ADDR, entity_addr_t())
|
||||
OPTION(cluster_addr, OPT_ADDR, entity_addr_t())
|
||||
OPTION(public_network, OPT_STR, "")
|
||||
|
@ -19,7 +19,7 @@ struct uuid_d {
|
||||
memset(&uuid, 0, sizeof(uuid));
|
||||
}
|
||||
|
||||
bool is_zero() {
|
||||
bool is_zero() const {
|
||||
return uuid_is_null(uuid);
|
||||
}
|
||||
|
||||
|
@ -97,10 +97,8 @@ int MonClient::build_initial_monmap(CephContext *cct, MonMap &monmap)
|
||||
}
|
||||
|
||||
// fsid from conf?
|
||||
if (cct->_conf->fsid.length()) {
|
||||
if (!monmap.fsid.parse(cct->_conf->fsid.c_str())) {
|
||||
cerr << " failed to parse fsid '" << cct->_conf->fsid << "'" << std::endl;
|
||||
}
|
||||
if (!cct->_conf->fsid.is_zero()) {
|
||||
monmap.fsid = cct->_conf->fsid;
|
||||
}
|
||||
|
||||
// -m foo?
|
||||
|
@ -124,17 +124,14 @@ int main(int argc, const char **argv)
|
||||
monmap.created = ceph_clock_now(g_ceph_context);
|
||||
monmap.last_changed = monmap.created;
|
||||
srand(getpid() + time(0));
|
||||
if (g_conf->fsid.empty()) {
|
||||
if (g_conf->fsid.is_zero()) {
|
||||
monmap.generate_fsid();
|
||||
cout << me << ": generated fsid " << monmap.fsid << std::endl;
|
||||
}
|
||||
modified = true;
|
||||
}
|
||||
if (g_conf->fsid.length()) {
|
||||
if (!monmap.fsid.parse(g_conf->fsid.c_str())) {
|
||||
cerr << me << ": failed to parse fsid '" << g_conf->fsid << "'" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
if (!g_conf->fsid.is_zero()) {
|
||||
monmap.fsid = g_conf->fsid;
|
||||
cout << me << ": set fsid to " << monmap.fsid << std::endl;
|
||||
modified = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user