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

Method _markAgentGone

src/master/http.cpp:4275–4355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4273
4274
4275Future<Response> Master::Http::_markAgentGone(const SlaveID& slaveId) const
4276{
4277 LOG(INFO) << "Marking agent '" << slaveId << "' as gone";
4278
4279 if (master->slaves.gone.contains(slaveId)) {
4280 LOG(WARNING) << "Not marking agent '" << slaveId
4281 << "' as gone because it has already transitioned to gone";
4282 return OK();
4283 }
4284
4285 // We return a `ServiceUnavailable` (retryable error) if there is
4286 // an ongoing registry transition to gone/removed/unreachable.
4287 if (master->slaves.markingGone.contains(slaveId)) {
4288 LOG(WARNING) << "Not marking agent '" << slaveId
4289 << "' as gone because another gone transition"
4290 << " is already in progress";
4291
4292 return ServiceUnavailable(
4293 "Agent '" + stringify(slaveId) + "' is already being transitioned"
4294 + " to gone");
4295 }
4296
4297 if (master->slaves.removing.contains(slaveId)) {
4298 LOG(WARNING) << "Not marking agent '" << slaveId
4299 << "' as gone because another remove transition"
4300 << " is already in progress";
4301
4302 return ServiceUnavailable(
4303 "Agent '" + stringify(slaveId) + "' is being transitioned to removed");
4304 }
4305
4306 if (master->slaves.markingUnreachable.contains(slaveId)) {
4307 LOG(WARNING) << "Not marking agent '" << slaveId
4308 << "' as gone because another unreachable transition"
4309 << " is already in progress";
4310
4311 return ServiceUnavailable(
4312 "Agent '" + stringify(slaveId) + "' is being transitioned to"
4313 + " unreachable");
4314 }
4315
4316 // We currently support marking an agent gone if the agent
4317 // is present in the list of active, unreachable or recovered agents.
4318 bool found = false;
4319
4320 if (master->slaves.registered.contains(slaveId)) {
4321 found = true;
4322 } else if(master->slaves.recovered.contains(slaveId)) {
4323 found = true;
4324 } else if (master->slaves.unreachable.contains(slaveId)) {
4325 found = true;
4326 }
4327
4328 if (!found) {
4329 return NotFound("Agent '" + stringify(slaveId) + "' not found");
4330 }
4331
4332 master->slaves.markingGone.insert(slaveId);

Callers

nothing calls this directly

Calls 15

OKClass · 0.85
ServiceUnavailableClass · 0.85
NotFoundClass · 0.85
getCurrentTimeFunction · 0.85
deferFunction · 0.85
insertMethod · 0.80
isDiscardedMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
markGoneMethod · 0.80
stringifyFunction · 0.50
containsMethod · 0.45

Tested by

no test coverage detected