Repository: mesos Updated Branches: refs/heads/1.5.x 547f5ec9a -> f6010e86f
Destroyed nested container on `attachContainerOutput` failure. After launching a container, the `LAUNCH_NESTED_CONTAINER_SESSION` handler calls into `attachContainerOutput()`. Previously, if `attachContainerOutput()` returned an HTTP response code other than 200, we didn't destroy the nested container. From the point of view of API users, if `LAUNCH_NESTED_CONTAINER_SESSION` returns an error, then no nested container should be left in the `RUNNING` state. This patch fixes this issue by destroying the nested container when HTTP errors are returned by this call to `attachContainerOutput()`. Review: https://reviews.apache.org/r/65637/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e5dc6dab Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e5dc6dab Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e5dc6dab Branch: refs/heads/1.5.x Commit: e5dc6dabbe736ed0fa3005b61817364ae5f49eef Parents: 547f5ec Author: Andrei Budnik <abud...@mesosphere.com> Authored: Tue Feb 13 10:53:30 2018 -0800 Committer: Greg Mann <gregorywm...@gmail.com> Committed: Tue Feb 13 12:10:08 2018 -0800 ---------------------------------------------------------------------- src/slave/http.cpp | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e5dc6dab/src/slave/http.cpp ---------------------------------------------------------------------- diff --git a/src/slave/http.cpp b/src/slave/http.cpp index 71e0bbb..a72050d 100644 --- a/src/slave/http.cpp +++ b/src/slave/http.cpp @@ -3558,6 +3558,11 @@ Future<Response> Http::launchNestedContainerSession( .then(defer(slave->self(), [=](const Response& response) -> Future<Response> { if (response.status != OK().status) { + LOG(WARNING) << "Failed to attach to nested container " + << containerId << ": '" << response.status << "' (" + << response.body << ")"; + + destroy(containerId); return response; }