Use the new OPT_UUID type.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
}
}
- 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()) {
/* 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, "")
memset(&uuid, 0, sizeof(uuid));
}
- bool is_zero() {
+ bool is_zero() const {
return uuid_is_null(uuid);
}
}
// 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?
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;
}