MCPcopy Create free account
hub / github.com/ceph/ceph / bootstrap

Method bootstrap

src/mon/Monitor.cc:1242–1349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1240}
1241
1242void Monitor::bootstrap()
1243{
1244 dout(10) << "bootstrap" << dendl;
1245 wait_for_paxos_write();
1246
1247 sync_reset_requester();
1248 unregister_cluster_logger();
1249 cancel_probe_timeout();
1250
1251 if (monmap->get_epoch() == 0) {
1252 dout(10) << "reverting to legacy ranks for seed monmap (epoch 0)" << dendl;
1253 monmap->calc_legacy_ranks();
1254 }
1255 dout(10) << "monmap " << *monmap << dendl;
1256 {
1257 auto from_release = monmap->min_mon_release;
1258 ostringstream err;
1259 if (!can_upgrade_from(from_release, "min_mon_release", err)) {
1260 derr << "current monmap has " << err.str() << " stopping." << dendl;
1261 exit(0);
1262 }
1263 }
1264 // note my rank
1265 int newrank = monmap->get_rank(messenger->get_myaddrs());
1266 if (newrank < 0 && rank >= 0) {
1267 // was i ever part of the quorum?
1268 if (has_ever_joined) {
1269 dout(0) << " removed from monmap, suicide." << dendl;
1270 exit(0);
1271 }
1272 elector.notify_clear_peer_state();
1273 }
1274 if (newrank >= 0 &&
1275 monmap->get_addrs(newrank) != messenger->get_myaddrs()) {
1276 dout(0) << " monmap addrs for rank " << newrank << " changed, i am "
1277 << messenger->get_myaddrs()
1278 << ", monmap is " << monmap->get_addrs(newrank) << ", respawning"
1279 << dendl;
1280
1281 if (monmap->get_epoch()) {
1282 // store this map in temp mon_sync location so that we use it on
1283 // our next startup
1284 derr << " stashing newest monmap " << monmap->get_epoch()
1285 << " for next startup" << dendl;
1286 bufferlist bl;
1287 monmap->encode(bl, -1);
1288 auto t(std::make_shared<MonitorDBStore::Transaction>());
1289 t->put("mon_sync", "temp_newer_monmap", bl);
1290 store->apply_transaction(t);
1291 }
1292
1293 respawn();
1294 }
1295 if (newrank != rank) {
1296 dout(0) << " my rank is now " << newrank << " (was " << rank << ")" << dendl;
1297 messenger->set_myname(entity_name_t::MON(newrank));
1298 rank = newrank;
1299 elector.notify_rank_changed(rank);

Callers 9

reset_electionMethod · 0.45
dispatchMethod · 0.45
handle_collectMethod · 0.45
handle_lastMethod · 0.45
collect_timeoutMethod · 0.45
accept_timeoutMethod · 0.45
do_refreshMethod · 0.45
lease_ack_timeoutMethod · 0.45
lease_timeoutMethod · 0.45

Calls 15

can_upgrade_fromFunction · 0.85
calc_legacy_ranksMethod · 0.80
apply_transactionMethod · 0.80
set_mynameMethod · 0.80
send_to_monMethod · 0.80
ceph_releaseFunction · 0.50
get_epochMethod · 0.45
strMethod · 0.45
get_rankMethod · 0.45
get_myaddrsMethod · 0.45
get_addrsMethod · 0.45

Tested by

no test coverage detected