MCPcopy Create free account
hub / github.com/apache/mesos / reregisterSlave

Method reregisterSlave

src/master/master.cpp:6542–6649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6540
6541
6542void Master::reregisterSlave(
6543 const UPID& from,
6544 ReregisterSlaveMessage&& reregisterSlaveMessage)
6545{
6546 ++metrics->messages_reregister_slave;
6547
6548 if (authenticating.contains(from)) {
6549 LOG(INFO) << "Queuing up re-registration request from " << from
6550 << " because authentication is still in progress";
6551
6552 authenticating[from]
6553 .onReady(defer(self(),
6554 &Self::reregisterSlave,
6555 from,
6556 std::move(reregisterSlaveMessage)));
6557 return;
6558 }
6559
6560 if (flags.authenticate_agents && !authenticated.contains(from)) {
6561 // This could happen if another authentication request came
6562 // through before we are here or if a slave tried to
6563 // reregister without authentication.
6564 LOG(WARNING) << "Refusing re-registration of agent at " << from
6565 << " because it is not authenticated";
6566 return;
6567 }
6568
6569 // TODO(bevers): Technically this behaviour seems to be incorrect, since we
6570 // discard the newer re-registration attempt, which might have additional
6571 // capabilities or a higher version (or a changed SlaveInfo, after Mesos 1.5).
6572 // However, this should very rarely happen in practice, and nobody seems to
6573 // have complained about it so far.
6574 const SlaveInfo& slaveInfo = reregisterSlaveMessage.slave();
6575 if (slaves.reregistering.contains(slaveInfo.id())) {
6576 LOG(INFO)
6577 << "Ignoring reregister agent message from agent "
6578 << slaveInfo.id() << " at " << from << " ("
6579 << slaveInfo.hostname() << ") as re-registration is already in progress";
6580
6581 return;
6582 }
6583
6584 if (slaves.markingGone.contains(slaveInfo.id())) {
6585 LOG(INFO)
6586 << "Ignoring reregister agent message from agent "
6587 << slaveInfo.id() << " at " << from << " ("
6588 << slaveInfo.hostname() << ") as a gone operation is already in progress";
6589
6590 return;
6591 }
6592
6593 if (slaves.gone.contains(slaveInfo.id())) {
6594 LOG(WARNING) << "Refusing re-registration of agent at " << from
6595 << " because it is already marked gone";
6596
6597 ShutdownMessage message;
6598 message.set_message("Agent has been marked gone");
6599 send(from, message);

Callers

nothing calls this directly

Calls 10

deferFunction · 0.85
reregisterSlaveFunction · 0.85
upgradeResourcesFunction · 0.85
insertMethod · 0.80
atMethod · 0.80
sendFunction · 0.50
PrincipalClass · 0.50
containsMethod · 0.45
idMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected