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

Method handle_monmap

src/mon/MonClient.cc:414–464  ·  view source on GitHub ↗

Unlike all the other message-handling functions, we don't put away a reference * because we want to support MMonMap passthrough to other Dispatchers. */

Source from the content-addressed store, hash-verified

412/* Unlike all the other message-handling functions, we don't put away a reference
413* because we want to support MMonMap passthrough to other Dispatchers. */
414void MonClient::handle_monmap(MMonMap *m)
415{
416 ldout(cct, 10) << __func__ << " " << *m << dendl;
417 auto con_addrs = m->get_source_addrs();
418 string old_name = monmap.get_name(con_addrs);
419 const auto old_epoch = monmap.get_epoch();
420
421 auto p = m->monmapbl.cbegin();
422 decode(monmap, p);
423
424 ldout(cct, 10) << " got monmap " << monmap.epoch
425 << " from mon." << old_name
426 << " (according to old e" << monmap.get_epoch() << ")"
427 << dendl;
428 ldout(cct, 10) << "dump:\n";
429 monmap.print(*_dout);
430 *_dout << dendl;
431
432 if (old_epoch != monmap.get_epoch()) {
433 tried.clear();
434 }
435 if (old_name.size() == 0) {
436 ldout(cct,10) << " can't identify which mon we were connected to" << dendl;
437 _reopen_session();
438 } else {
439 auto new_name = monmap.get_name(con_addrs);
440 if (new_name.empty()) {
441 ldout(cct, 10) << "mon." << old_name << " at " << con_addrs
442 << " went away" << dendl;
443 // can't find the mon we were talking to (above)
444 _reopen_session();
445 } else if (messenger->should_use_msgr2() &&
446 monmap.get_addrs(new_name).has_msgr2() &&
447 !con_addrs.has_msgr2()) {
448 ldout(cct,1) << " mon." << new_name << " has (v2) addrs "
449 << monmap.get_addrs(new_name) << " but i'm connected to "
450 << con_addrs << ", reconnecting" << dendl;
451 _reopen_session();
452 }
453 }
454
455 cct->set_mon_addrs(monmap);
456
457 sub.got("monmap", monmap.get_epoch());
458 map_cond.notify_all();
459 want_monmap = false;
460
461 if (authenticate_err == 1) {
462 _finish_auth(0);
463 }
464}
465
466void MonClient::handle_config(MConfig *m)
467{

Callers

nothing calls this directly

Calls 15

get_source_addrsMethod · 0.80
has_msgr2Method · 0.80
decodeFunction · 0.70
get_nameMethod · 0.45
get_epochMethod · 0.45
cbeginMethod · 0.45
printMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
should_use_msgr2Method · 0.45
get_addrsMethod · 0.45

Tested by

no test coverage detected