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

Method _killContainer

src/slave/http.cpp:3724–3761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3722
3723template <mesos::authorization::Action action>
3724Future<Response> Http::_killContainer(
3725 const ContainerID& containerId,
3726 const int signal,
3727 ContentType acceptType,
3728 const Owned<ObjectApprovers>& approvers) const
3729{
3730 // Attempt to get the executor associated with this ContainerID.
3731 // We only expect to get the executor when killing a nested container
3732 // under a container launched via a scheduler. In other cases, we are
3733 // killing a standalone container (possibly nested).
3734 Executor* executor = slave->getExecutor(containerId);
3735 if (executor == nullptr) {
3736 if (!approvers->approved<action>(containerId)) {
3737 return Forbidden();
3738 }
3739 } else {
3740 Framework* framework = slave->getFramework(executor->frameworkId);
3741 CHECK_NOTNULL(framework);
3742
3743 if (!approvers->approved<action>(
3744 executor->info,
3745 framework->info,
3746 containerId)) {
3747 return Forbidden();
3748 }
3749 }
3750
3751 Future<bool> kill = slave->containerizer->kill(containerId, signal);
3752
3753 return kill
3754 .then([containerId](bool found) -> Response {
3755 if (!found) {
3756 return NotFound("Container '" + stringify(containerId) + "'"
3757 " cannot be found (or is already killed)");
3758 }
3759 return OK();
3760 });
3761}
3762
3763
3764Future<Response> Http::removeNestedContainer(

Callers

nothing calls this directly

Calls 8

ForbiddenClass · 0.85
NotFoundClass · 0.85
OKClass · 0.85
getExecutorMethod · 0.80
stringifyFunction · 0.50
getFrameworkMethod · 0.45
killMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected