dout(10) << __func__ << dendl;
/*
* the monmap may be in one of three places:
+ * 'mon_sync:temp_newer_monmap' - stashed newer map for bootstrap
* 'monmap:<latest_version_no>' - the monmap we'd really like to have
* 'mon_sync:latest_monmap' - last monmap backed up for the last sync
* 'mkfs:monmap' - a monmap resulting from mkfs
ceph_assert(bl.length() > 0);
dout(10) << __func__ << " read last committed monmap ver "
<< latest_ver << dendl;
+
+ // see if there is stashed newer map (see bootstrap())
+ if (store.exists("mon_sync", "temp_newer_monmap")) {
+ bufferlist bl2;
+ int err = store.get("mon_sync", "temp_newer_monmap", bl2);
+ ceph_assert(err == 0);
+ ceph_assert(bl2.length() > 0);
+ MonMap b;
+ b.decode(bl2);
+ if (b.get_epoch() > latest_ver) {
+ dout(10) << __func__ << " using stashed monmap " << b.get_epoch()
+ << " instead" << dendl;
+ bl.claim(bl2);
+ } else {
+ dout(10) << __func__ << " ignoring stashed monmap " << b.get_epoch()
+ << dendl;
+ }
+ }
return 0;
}
}
pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
dout(10) << "public_network " << g_conf()->public_network << dendl;
- dout(10) << "public_addr " << g_conf()->public_network << dendl;
+ dout(10) << "public_addr " << g_conf()->public_addr << dendl;
+ dout(10) << "public_addrv " << g_conf()->public_addrv << dendl;
common_init_finish(g_ceph_context);
if (monmap.contains(g_conf()->name.get_id())) {
// hmm, make sure the ip listed exists on the current host?
// maybe later.
+ } else if (!g_conf()->public_addrv.empty()) {
+ entity_addrvec_t av = g_conf()->public_addrv;
+ string name;
+ if (monmap.contains(av, &name)) {
+ monmap.rename(name, g_conf()->name.get_id());
+ dout(0) << argv[0] << ": renaming mon." << name << " " << av
+ << " to mon." << g_conf()->name.get_id() << dendl;
+ }
} else if (!g_conf()->public_addr.is_blank_ip()) {
entity_addrvec_t av = make_mon_addrs(g_conf()->public_addr);
string name;
string val;
int r = store->read_meta("min_mon_release", &val);
if (r >= 0 && val.size()) {
- int min = atoi(val.c_str());
- if (min &&
- min + 2 < (int)ceph_release()) {
- derr << "recorded min_mon_release is " << min
- << " (" << ceph_release_name(min)
- << ") which is >2 releases older than installed "
- << ceph_release() << " (" << ceph_release_name(ceph_release())
- << "); you can only upgrade 2 releases at a time" << dendl;
- derr << "you should first upgrade to "
- << (min + 1) << " (" << ceph_release_name(min + 1) << ") or "
- << (min + 2) << " (" << ceph_release_name(min + 2) << ")" << dendl;
+ ceph_release_t from_release = ceph_release_from_name(val);
+ ostringstream err;
+ if (!can_upgrade_from(from_release, "min_mon_release", err)) {
+ derr << err.str() << dendl;
prefork.exit(1);
}
}
dout(0) << g_conf()->name << " does not exist in monmap, will attempt to join an existing cluster" << dendl;
pick_addresses(g_ceph_context, CEPH_PICK_ADDRESS_PUBLIC);
- if (!g_conf()->public_addr.is_blank_ip()) {
+ if (!g_conf()->public_addrv.empty()) {
+ ipaddrs = g_conf()->public_addrv;
+ dout(0) << "using public_addrv " << ipaddrs << dendl;
+ } else if (!g_conf()->public_addr.is_blank_ip()) {
ipaddrs = make_mon_addrs(g_conf()->public_addr);
dout(0) << "using public_addr " << g_conf()->public_addr << " -> "
<< ipaddrs << dendl;
std::string public_msgr_type = g_conf()->ms_public_type.empty() ? g_conf().get_val<std::string>("ms_type") : g_conf()->ms_public_type;
Messenger *msgr = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::MON(rank), "mon",
- 0, Messenger::HAS_MANY_CONNECTIONS);
+ 0, // zero nonce
+ Messenger::HAS_MANY_CONNECTIONS);
if (!msgr)
exit(1);
msgr->set_cluster_protocol(CEPH_MON_PROTOCOL);
Messenger *mgr_msgr = Messenger::create(g_ceph_context, public_msgr_type,
entity_name_t::MON(rank), "mon-mgrc",
- getpid(), 0);
+ Messenger::get_pid_nonce(),
+ 0);
if (!mgr_msgr) {
derr << "unable to create mgr_msgr" << dendl;
prefork.exit(1);
if (force_sync) {
derr << "flagging a forced sync ..." << dendl;
ostringstream oss;
- mon->sync_force(NULL, oss);
- if (oss.tellp())
- derr << oss.str() << dendl;
+ JSONFormatter jf(true);
+ mon->sync_force(&jf);
+ derr << "out:\n";
+ jf.flush(*_dout);
+ *_dout << dendl;
}
err = mon->preinit();