You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/10/07 01:23:21 UTC
mesos git commit: Store terminated containers in the test
containerizer.
Repository: mesos
Updated Branches:
refs/heads/master 3902b051f -> 8dd9b65e7
Store terminated containers in the test containerizer.
This allows callers to "reap" containers that are already terminated,
mimicing the behavior of the mesos containerizer.
This also fixes MESOS-6319, where the `wait()` could occur after a
`destroy()` had already completed.
Review: https://reviews.apache.org/r/52615
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8dd9b65e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8dd9b65e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8dd9b65e
Branch: refs/heads/master
Commit: 8dd9b65e78e2b91fd68a33224c844969d3b9ffad
Parents: 3902b05
Author: Benjamin Mahler <bm...@apache.org>
Authored: Thu Oct 6 12:35:38 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu Oct 6 18:22:47 2016 -0700
----------------------------------------------------------------------
src/tests/containerizer.cpp | 17 +++++++++++++++++
src/tests/containerizer.hpp | 4 ++++
2 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/8dd9b65e/src/tests/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer.cpp b/src/tests/containerizer.cpp
index 3affa0f..27c29b4 100644
--- a/src/tests/containerizer.cpp
+++ b/src/tests/containerizer.cpp
@@ -110,6 +110,13 @@ Future<bool> TestContainerizer::_launch(
const map<string, string>& environment,
bool checkpoint)
{
+ CHECK(!terminatedContainers.contains(containerId))
+ << "Failed to launch nested container " << containerId
+ << " for executor '" << executorInfo.executor_id() << "'"
+ << " of framework " << executorInfo.framework_id()
+ << " because this ContainerID is being re-used with"
+ << " a previously terminated container";
+
CHECK(!containers_.contains(containerId))
<< "Failed to launch container " << containerId
<< " for executor '" << executorInfo.executor_id() << "'"
@@ -202,6 +209,11 @@ Future<bool> TestContainerizer::_launch(
const Option<string>& user,
const SlaveID& slaveId)
{
+ CHECK(!terminatedContainers.contains(containerId))
+ << "Failed to launch nested container " << containerId
+ << " because this ContainerID is being re-used with"
+ << " a previously terminated container";
+
CHECK(!containers_.contains(containerId))
<< "Failed to launch nested container " << containerId
<< " because it is already launched";
@@ -216,6 +228,10 @@ Future<bool> TestContainerizer::_launch(
Future<Option<ContainerTermination>> TestContainerizer::_wait(
const ContainerID& containerId) const
{
+ if (terminatedContainers.contains(containerId)) {
+ return terminatedContainers.at(containerId);
+ }
+
// An unknown container is possible for tests where we "drop" the
// 'launch' in order to verify recovery still works correctly.
if (!containers_.contains(containerId)) {
@@ -282,6 +298,7 @@ Future<bool> TestContainerizer::_destroy(const ContainerID& containerId)
containerData->termination.set(termination);
containers_.erase(containerId);
+ terminatedContainers[containerId] = termination;
return true;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/8dd9b65e/src/tests/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer.hpp b/src/tests/containerizer.hpp
index 0ffba73..940c414 100644
--- a/src/tests/containerizer.hpp
+++ b/src/tests/containerizer.hpp
@@ -162,7 +162,11 @@ private:
process::Promise<mesos::slave::ContainerTermination> termination;
};
+ // We also store the terminated containers to allow callers to
+ // "reap" the termination if a container is already destroyed.
+ // This mimics the behavior of the mesos containerizer.
hashmap<ContainerID, process::Owned<ContainerData>> containers_;
+ hashmap<ContainerID, mesos::slave::ContainerTermination> terminatedContainers;
struct ExecutorData
{