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

Method _reregisterSlave

src/master/master.cpp:6652–6890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6650
6651
6652void Master::_reregisterSlave(
6653 const UPID& pid,
6654 ReregisterSlaveMessage&& reregisterSlaveMessage,
6655 const Option<Principal>& principal,
6656 const Future<bool>& authorized)
6657{
6658 CHECK(!authorized.isDiscarded());
6659
6660 const SlaveInfo& slaveInfo = reregisterSlaveMessage.slave();
6661 CHECK(slaves.reregistering.contains(slaveInfo.id()));
6662
6663 Option<string> authorizationError = None();
6664
6665 if (authorized.isFailed()) {
6666 authorizationError = "Authorization failure: " + authorized.failure();
6667 } else if (!authorized.get()) {
6668 authorizationError =
6669 "Not authorized to reregister agent providing resources "
6670 "'" + stringify(Resources(slaveInfo.resources())) + "' " +
6671 (principal.isSome()
6672 ? "with principal '" + stringify(principal.get()) + "'"
6673 : "without a principal");
6674 }
6675
6676 if (authorizationError.isSome()) {
6677 LOG(WARNING) << "Refusing re-registration of agent " << slaveInfo.id()
6678 << " at " << pid << " (" << slaveInfo.hostname() << ")"
6679 << ": " << authorizationError.get();
6680
6681 slaves.reregistering.erase(slaveInfo.id());
6682 return;
6683 }
6684
6685 if (slaves.markingGone.contains(slaveInfo.id())) {
6686 LOG(INFO)
6687 << "Ignoring reregister agent message from agent "
6688 << slaveInfo.id() << " at " << pid << " ("
6689 << slaveInfo.hostname() << ") as a gone operation is already in progress";
6690
6691 slaves.reregistering.erase(slaveInfo.id());
6692 return;
6693 }
6694
6695 if (slaves.gone.contains(slaveInfo.id())) {
6696 LOG(WARNING) << "Refusing re-registration of agent at " << pid
6697 << " because it is already marked gone";
6698
6699 ShutdownMessage message;
6700 message.set_message("Agent has been marked gone");
6701 send(pid, message);
6702
6703 slaves.reregistering.erase(slaveInfo.id());
6704 return;
6705 }
6706
6707 VLOG(1) << "Authorized re-registration of agent " << slaveInfo.id()
6708 << " at " << pid << " (" << slaveInfo.hostname() << ")";
6709

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
copyFunction · 0.85
isTerminalStateFunction · 0.85
deferFunction · 0.85
isDiscardedMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
versionMethod · 0.80
infoMethod · 0.80
atMethod · 0.80
foreachvalueFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected