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

Method removeSlave

src/master/master.cpp:10750–10800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10748
10749
10750void Master::removeSlave(
10751 Slave* slave,
10752 const string& message,
10753 Option<Counter> reason)
10754{
10755 CHECK_NOTNULL(slave);
10756
10757 // It would be better to remove the slave here instead of continuing
10758 // to mark it unreachable, but probably not worth the complexity.
10759 if (slaves.markingUnreachable.contains(slave->id)) {
10760 LOG(WARNING) << "Ignoring removal of agent " << *slave
10761 << " that is in the process of being marked unreachable";
10762
10763 return;
10764 }
10765
10766 if (slaves.markingGone.contains(slave->id)) {
10767 LOG(WARNING) << "Ignoring removal of agent " << *slave
10768 << " that is in the process of being marked gone";
10769
10770 return;
10771 }
10772
10773 // This should not be possible, but we protect against it anyway for
10774 // the sake of paranoia.
10775 if (slaves.removing.contains(slave->id)) {
10776 LOG(WARNING) << "Ignoring removal of agent " << *slave
10777 << " that is in the process of being removed";
10778
10779 return;
10780 }
10781
10782 slaves.removing.insert(slave->id);
10783
10784 LOG(INFO) << "Removing agent " << *slave << ": " << message;
10785
10786 // Remove this slave from the registrar. Note that we update the
10787 // registry BEFORE we update the master's in-memory state; this
10788 // means that until the registry operation has completed, the slave
10789 // is not considered to be removed (so we might offer its resources
10790 // to frameworks, etc.). Ensuring that the registry update succeeds
10791 // before we modify in-memory state ensures that external clients
10792 // see consistent behavior if the master fails over.
10793 registrar->apply(Owned<RegistryOperation>(new RemoveSlave(slave->info)))
10794 .onAny(defer(self(),
10795 &Self::_removeSlave,
10796 slave,
10797 lambda::_1,
10798 message,
10799 reason));
10800}
10801
10802
10803void Master::_removeSlave(

Callers 9

TEST_FFunction · 0.45
TESTFunction · 0.45
foreachFunction · 0.45
ACTION_PFunction · 0.45
foreachFunction · 0.45
finalizeMethod · 0.45
_removeSlaveMethod · 0.45
__removeSlaveMethod · 0.45

Calls 4

deferFunction · 0.85
insertMethod · 0.80
containsMethod · 0.45
applyMethod · 0.45

Tested by 5

TEST_FFunction · 0.36
TESTFunction · 0.36
foreachFunction · 0.36
ACTION_PFunction · 0.36