Ensured that `wait()` and `destroy()` return the same result.

We need to return the same `ContainerTermination` result for both
`wait()` and `destroy()` for a terminated container. This patch
ensures that for a terminated nested container `destroy()` returns
the same result as for `wait()`.

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


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

Branch: refs/heads/master
Commit: a4492f7767ef056bc4ea11f17d61521d547f38aa
Parents: 896c593
Author: Andrei Budnik <abud...@mesosphere.com>
Authored: Fri May 25 09:08:02 2018 +0800
Committer: Qian Zhang <zhq527...@gmail.com>
Committed: Fri May 25 09:08:02 2018 +0800

----------------------------------------------------------------------
 src/slave/containerizer/composing.cpp           | 5 ++++-
 src/slave/containerizer/mesos/containerizer.cpp | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a4492f77/src/slave/containerizer/composing.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/composing.cpp 
b/src/slave/containerizer/composing.cpp
index 3c03d66..7144ba7 100644
--- a/src/slave/containerizer/composing.cpp
+++ b/src/slave/containerizer/composing.cpp
@@ -605,7 +605,10 @@ Future<Option<ContainerTermination>> 
ComposingContainerizerProcess::destroy(
     // Move this logging into the callers.
     LOG(WARNING) << "Attempted to destroy unknown container " << containerId;
 
-    return None();
+    // A nested container might have already been terminated, therefore
+    // `containers_` might not contain it, but its exit status might have
+    // been checkpointed.
+    return wait(containerId);
   }
 
   Container* container = containers_.at(containerId);

http://git-wip-us.apache.org/repos/asf/mesos/blob/a4492f77/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp 
b/src/slave/containerizer/mesos/containerizer.cpp
index 51edb58..6620e94 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -2383,7 +2383,10 @@ Future<Option<ContainerTermination>> 
MesosContainerizerProcess::destroy(
     // Move this logging into the callers.
     LOG(WARNING) << "Attempted to destroy unknown container " << containerId;
 
-    return None();
+    // A nested container might have already been terminated, therefore
+    // `containers_` might not contain it, but its exit status might have
+    // been checkpointed.
+    return wait(containerId);
   }
 
   const Owned<Container>& container = containers_.at(containerId);

Reply via email to