You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2017/01/24 23:00:33 UTC

mesos git commit: Moved check for 'has_parent()' in docker containerizer destroy.

Repository: mesos
Updated Branches:
  refs/heads/master 7f83b6e34 -> cbc3e61f6


Moved check for 'has_parent()' in docker containerizer destroy.

Ideally, we would do this check as the first thing we do after
entering this function. However, the containerizer API currently
requires callers of `launch()` to also call `destroy()` if the launch
fails (MESOS-6214). As such, putting the check at the top of this
function would cause the containerizer to crash if the launch failure
was due to the container having its `parent` field set. Once we remove
the requirement for `destroy()` to be called explicitly after launch
failures, we should move this check back to the top of this function.

Review: https://reviews.apache.org/r/55778/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cbc3e61f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cbc3e61f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cbc3e61f

Branch: refs/heads/master
Commit: cbc3e61f6538fc7978116f8009c6436dbd3ec10a
Parents: 7f83b6e
Author: Kevin Klues <kl...@gmail.com>
Authored: Tue Jan 24 15:00:21 2017 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Tue Jan 24 15:00:21 2017 -0800

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cbc3e61f/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index a98e001..886528f 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -2005,8 +2005,6 @@ Future<bool> DockerContainerizerProcess::destroy(
     const ContainerID& containerId,
     bool killed)
 {
-  CHECK(!containerId.has_parent());
-
   if (!containers_.contains(containerId)) {
     // TODO(bmahler): Currently the agent does not log destroy
     // failures or unknown containers, so we log it here for now.
@@ -2016,6 +2014,17 @@ Future<bool> DockerContainerizerProcess::destroy(
     return false;
   }
 
+  // TODO(klueska): Ideally, we would do this check as the first thing
+  // we do after entering this function. However, the containerizer
+  // API currently requires callers of `launch()` to also call
+  // `destroy()` if the launch fails (MESOS-6214). As such, putting
+  // the check at the top of this function would cause the
+  // containerizer to crash if the launch failure was due to the
+  // container having its `parent` field set. Once we remove the
+  // requirement for `destroy()` to be called explicitly after launch
+  // failures, we should move this check to the top of this function.
+  CHECK(!containerId.has_parent());
+
   Container* container = containers_.at(containerId);
 
   if (container->launch.isFailed()) {