You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/08/25 18:45:27 UTC
[1/8] mesos git commit: Updated a few comments in MesosContainerizer.
Repository: mesos
Updated Branches:
refs/heads/master 711797086 -> 69a8854d1
Updated a few comments in MesosContainerizer.
Review: https://reviews.apache.org/r/51418
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/69a8854d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/69a8854d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/69a8854d
Branch: refs/heads/master
Commit: 69a8854d1530897ee623ef6319d226ff60ca9198
Parents: f4894ec
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 22:13:12 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.hpp | 21 ++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/69a8854d/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 5da561c..078ef4f 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -294,31 +294,32 @@ private:
// isolators and provisioner after that.
Option<process::Future<Option<int>>> status;
- // We keep track of the future that is waiting for the provisioner's
- // `ProvisionInfo`, so that destroy will only start calling
- // provisioner->destroy after provisioner->provision has finished.
+ // We keep track of the future for 'provisioner->provision' so
+ // that destroy will only start calling 'provisioner->destroy'
+ // after 'provisioner->provision' has finished.
process::Future<ProvisionInfo> provisioning;
// We keep track of the future that is waiting for all the
- // isolators' prepare futures, so that destroy will only start
+ // 'isolator->prepare' to finish so that destroy will only start
// calling cleanup after all isolators have finished preparing.
process::Future<std::list<Option<mesos::slave::ContainerLaunchInfo>>>
launchInfos;
// We keep track of the future that is waiting for all the
- // isolators' isolate futures, so that destroy will only start
+ // 'isolator->isolate' futures so that destroy will only start
// calling cleanup after all isolators have finished isolating.
process::Future<std::list<Nothing>> isolation;
- // We keep track of any limitations received from each isolator so we can
- // determine the cause of an executor termination.
+ // We keep track of any limitations received from each isolator so
+ // we can determine the cause of a container termination.
std::vector<mesos::slave::ContainerLimitation> limitations;
- // We keep track of the resources for each container so we can set the
- // ResourceStatistics limits in usage().
+ // We keep track of the resources for each container so we can set
+ // the ResourceStatistics limits in usage().
Resources resources;
- // The configuration for the container to be launched.
+ // The configuration for the container to be launched. This field
+ // is only used during the launch of a container.
mesos::slave::ContainerConfig config;
State state;
[2/8] mesos git commit: Fixed a TODO in the MesosContainerizer.
Posted by ji...@apache.org.
Fixed a TODO in the MesosContainerizer.
This patch fixed a bug in the destory path. It correctly handles a
race where the container is destroyed while it is being launched. The
idea is to make 'container->status' optional and don't set it until
the container is actually forked.
Review: https://reviews.apache.org/r/51416
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ee6b7495
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ee6b7495
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ee6b7495
Branch: refs/heads/master
Commit: ee6b7495d059f47f08735fb463c7cfd07bfc9877
Parents: 1bd974b
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 22:06:17 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 29 ++++++++++++--------
src/slave/containerizer/mesos/containerizer.hpp | 12 +++++---
2 files changed, 26 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ee6b7495/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index f72d734..b225e06 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1628,17 +1628,20 @@ void MesosContainerizerProcess::destroy(
container->state = DESTROYING;
- // TODO(jieyu): It's likely that the launcher already forked the
- // container. However, since we change the state to 'DESTROYING',
- // the 'isolate()' will fail, causing the control pipes being
- // closed. The container will terminate itself. However, we should
- // wait for the container to terminate before we start to cleanup
- // isolators.
-
// We need to wait for the isolators to finish preparing to
// prevent a race that the destroy method calls the 'cleanup'
// method of an isolator before the 'prepare' method is called.
- container->launchInfos
+ //
+ // NOTE: It's likely that the launcher already forked the
+ // container. However, since we change the state to 'DESTROYING',
+ // the 'isolate()' will fail, causing the control pipes being
+ // closed. The container will terminate itself. Therefore, we
+ // should wait for the container to terminate before we start to
+ // cleanup isolators.
+ await(container->launchInfos,
+ container->status.isSome()
+ ? container->status.get()
+ : None())
.onAny(defer(self(), &Self::___destroy, containerId));
return;
@@ -1707,7 +1710,9 @@ void MesosContainerizerProcess::__destroy(
// We've successfully killed all processes in the container so get
// the exit status of the executor when it's ready (it may already
// be) and continue the destroy.
- container->status
+ CHECK_SOME(container->status);
+
+ container->status.get()
.onAny(defer(self(), &Self::___destroy, containerId));
}
@@ -1782,8 +1787,10 @@ void MesosContainerizerProcess::_____destroy(
ContainerTermination termination;
- if (container->status.isReady() && container->status->isSome()) {
- termination.set_status(container->status->get());
+ if (container->status.isSome() &&
+ container->status->isReady() &&
+ container->status->get().isSome()) {
+ termination.set_status(container->status->get().get());
}
// NOTE: We may not see a limitation in time for it to be
http://git-wip-us.apache.org/repos/asf/mesos/blob/ee6b7495/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 3e4fb97..5da561c 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -285,10 +285,14 @@ private:
// Promise for futures returned from wait().
process::Promise<mesos::slave::ContainerTermination> promise;
- // We need to keep track of the future exit status for each
- // executor because we'll only get a single notification when
- // the executor exits.
- process::Future<Option<int>> status;
+ // We keep track of the future exit status for the container if it
+ // has been launched. If the container has not been launched yet,
+ // 'status' will be set to None().
+ //
+ // NOTE: A container has an exit status does not mean that it has
+ // been properly destroyed. We need to perform cleanup on
+ // isolators and provisioner after that.
+ Option<process::Future<Option<int>>> status;
// We keep track of the future that is waiting for the provisioner's
// `ProvisionInfo`, so that destroy will only start calling
[3/8] mesos git commit: Removed 'status' in the destroy chain in
MesosContainerizer.
Posted by ji...@apache.org.
Removed 'status' in the destroy chain in MesosContainerizer.
'status' is already part of the 'Container' struct. No need to pass it
in the destroy chain. This patch removed it.
Review: https://reviews.apache.org/r/51401
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/627c6468
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/627c6468
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/627c6468
Branch: refs/heads/master
Commit: 627c64687bc8d60086e98362509e20e98d4981fc
Parents: ba435cc
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 17:41:17 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 54 ++++----------------
src/slave/containerizer/mesos/containerizer.hpp | 6 +--
2 files changed, 12 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/627c6468/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index d381d13..0b82a47 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1610,7 +1610,6 @@ void MesosContainerizerProcess::destroy(
self(),
&Self::____destroy,
containerId,
- None(),
list<Future<Nothing>>()));
return;
@@ -1633,11 +1632,7 @@ void MesosContainerizerProcess::destroy(
// prevent a race that the destroy method calls the 'cleanup'
// method of an isolator before the 'prepare' method is called.
container->launchInfos
- .onAny(defer(
- self(),
- &Self::___destroy,
- containerId,
- None()));
+ .onAny(defer(self(), &Self::___destroy, containerId));
return;
}
@@ -1651,10 +1646,7 @@ void MesosContainerizerProcess::destroy(
// Wait for the isolators to finish isolating before we start
// to destroy the container.
container->isolation
- .onAny(defer(
- self(),
- &Self::_destroy,
- containerId));
+ .onAny(defer(self(), &Self::_destroy, containerId));
return;
}
@@ -1676,11 +1668,7 @@ void MesosContainerizerProcess::_destroy(
// Kill all processes then continue destruction.
launcher->destroy(containerId)
- .onAny(defer(
- self(),
- &Self::__destroy,
- containerId,
- lambda::_1));
+ .onAny(defer(self(), &Self::__destroy, containerId, lambda::_1));
}
@@ -1713,33 +1701,22 @@ void MesosContainerizerProcess::__destroy(
// the exit status of the executor when it's ready (it may already
// be) and continue the destroy.
container->status
- .onAny(defer(
- self(),
- &Self::___destroy,
- containerId,
- lambda::_1));
+ .onAny(defer(self(), &Self::___destroy, containerId));
}
void MesosContainerizerProcess::___destroy(
- const ContainerID& containerId,
- const Future<Option<int>>& status)
+ const ContainerID& containerId)
{
CHECK(containers_.contains(containerId));
cleanupIsolators(containerId)
- .onAny(defer(
- self(),
- &Self::____destroy,
- containerId,
- status,
- lambda::_1));
+ .onAny(defer(self(), &Self::____destroy, containerId, lambda::_1));
}
void MesosContainerizerProcess::____destroy(
const ContainerID& containerId,
- const Future<Option<int>>& status,
const Future<list<Future<Nothing>>>& cleanups)
{
// This should not occur because we only use the Future<list> to
@@ -1755,31 +1732,23 @@ void MesosContainerizerProcess::____destroy(
foreach (const Future<Nothing>& cleanup, cleanups.get()) {
if (!cleanup.isReady()) {
container->promise.fail(
- "Failed to clean up an isolator when destroying container '" +
- stringify(containerId) + "': " +
- (cleanup.isFailed() ? cleanup.failure() : "discarded future"));
+ "Failed to clean up an isolator when destroying container: " +
+ (cleanup.isFailed() ? cleanup.failure() : "discarded"));
containers_.erase(containerId);
++metrics.container_destroy_errors;
-
return;
}
}
provisioner->destroy(containerId)
- .onAny(defer(
- self(),
- &Self::_____destroy,
- containerId,
- status,
- lambda::_1));
+ .onAny(defer(self(), &Self::_____destroy, containerId, lambda::_1));
}
void MesosContainerizerProcess::_____destroy(
const ContainerID& containerId,
- const Future<Option<int>>& status,
const Future<bool>& destroy)
{
CHECK(containers_.contains(containerId));
@@ -1795,14 +1764,13 @@ void MesosContainerizerProcess::_____destroy(
containers_.erase(containerId);
++metrics.container_destroy_errors;
-
return;
}
ContainerTermination termination;
- if (status.isReady() && status->isSome()) {
- termination.set_status(status->get());
+ if (container->status.isReady() && container->status->isSome()) {
+ termination.set_status(container->status->get());
}
// NOTE: We may not see a limitation in time for it to be
http://git-wip-us.apache.org/repos/asf/mesos/blob/627c6468/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 681ee00..3e4fb97 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -232,21 +232,17 @@ private:
const process::Future<Nothing>& future);
// Continues '__destroy()' once we get the exit status of the executor.
- void ___destroy(
- const ContainerID& containerId,
- const process::Future<Option<int>>& status);
+ void ___destroy(const ContainerID& containerId);
// Continues '___destroy()' once all isolators have completed
// cleanup.
void ____destroy(
const ContainerID& containerId,
- const process::Future<Option<int>>& status,
const process::Future<std::list<process::Future<Nothing>>>& cleanups);
// Continues '____destroy()' once provisioner have completed destroy.
void _____destroy(
const ContainerID& containerId,
- const process::Future<Option<int>>& status,
const process::Future<bool>& destroy);
// Call back for when an isolator limits a container and impacts the
[7/8] mesos git commit: Removed a NOTE in MesosContainerizer that no
longer applies.
Posted by ji...@apache.org.
Removed a NOTE in MesosContainerizer that no longer applies.
Previously, we need to initialize `launchInfos` because we don't yet
have an explicit state for PROVISIONING (MESOS-4878). After we
introduce the PROVISIONING state, it's guaranteed that `launchInfo`
will be set if the container is in PREPARING state. Therefore, the
NOTE and the corresponding code is no longer needed.
Review: https://reviews.apache.org/r/51417
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f4894ec9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f4894ec9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f4894ec9
Branch: refs/heads/master
Commit: f4894ec9b9b6b1e2e980204835e4f81a5215ea81
Parents: ee6b749
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 22:08:28 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f4894ec9/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index b225e06..7584a11 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -882,12 +882,6 @@ Future<bool> MesosContainerizerProcess::launch(
container->config = containerConfig;
container->resources = containerConfig.resources();
- // We need to set the `launchInfos` to be a ready future initially
- // before we starting calling isolator->prepare() because otherwise,
- // the destroy will wait forever trying to wait for this future to
- // be ready, which it never will. See MESOS-4878.
- container->launchInfos = list<Option<ContainerLaunchInfo>>();
-
containers_.put(containerId, container);
// We'll first provision the image for the container, and
[5/8] mesos git commit: Stopped passing messages in
MesosContainerizer destroy methods.
Posted by ji...@apache.org.
Stopped passing messages in MesosContainerizer destroy methods.
The extra message is introduced in:
https://reviews.apache.org/r/28141.
I don't see a strong reason why we need such messages from that patch.
Furthermore, the message is not quite useful because it is not the
root cause of the destroy. Finally, the `Executor terminated` message
no longer applies when we destroy a nested container. The same message
is already generated properly in the agent.
Review: https://reviews.apache.org/r/51400
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ba435cc2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ba435cc2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ba435cc2
Branch: refs/heads/master
Commit: ba435cc2e23b40927460bcb6052e2498a474355c
Parents: 7117970
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 16:01:22 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 61 +++++++++-----------
src/slave/containerizer/mesos/containerizer.hpp | 9 +--
.../containerizer/mesos_containerizer_tests.cpp | 16 -----
3 files changed, 31 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ba435cc2/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index e87292f..d381d13 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1611,8 +1611,7 @@ void MesosContainerizerProcess::destroy(
&Self::____destroy,
containerId,
None(),
- list<Future<Nothing>>(),
- "Container destroyed while provisioning images"));
+ list<Future<Nothing>>()));
return;
}
@@ -1638,8 +1637,7 @@ void MesosContainerizerProcess::destroy(
self(),
&Self::___destroy,
containerId,
- None(),
- "Container destroyed while preparing isolators"));
+ None()));
return;
}
@@ -1653,7 +1651,10 @@ void MesosContainerizerProcess::destroy(
// Wait for the isolators to finish isolating before we start
// to destroy the container.
container->isolation
- .onAny(defer(self(), &Self::_destroy, containerId));
+ .onAny(defer(
+ self(),
+ &Self::_destroy,
+ containerId));
return;
}
@@ -1675,7 +1676,11 @@ void MesosContainerizerProcess::_destroy(
// Kill all processes then continue destruction.
launcher->destroy(containerId)
- .onAny(defer(self(), &Self::__destroy, containerId, lambda::_1));
+ .onAny(defer(
+ self(),
+ &Self::__destroy,
+ containerId,
+ lambda::_1));
}
@@ -1712,33 +1717,30 @@ void MesosContainerizerProcess::__destroy(
self(),
&Self::___destroy,
containerId,
- lambda::_1,
- None()));
+ lambda::_1));
}
void MesosContainerizerProcess::___destroy(
const ContainerID& containerId,
- const Future<Option<int>>& status,
- const Option<string>& message)
+ const Future<Option<int>>& status)
{
CHECK(containers_.contains(containerId));
cleanupIsolators(containerId)
- .onAny(defer(self(),
- &Self::____destroy,
- containerId,
- status,
- lambda::_1,
- message));
+ .onAny(defer(
+ self(),
+ &Self::____destroy,
+ containerId,
+ status,
+ lambda::_1));
}
void MesosContainerizerProcess::____destroy(
const ContainerID& containerId,
const Future<Option<int>>& status,
- const Future<list<Future<Nothing>>>& cleanups,
- Option<string> message)
+ const Future<list<Future<Nothing>>>& cleanups)
{
// This should not occur because we only use the Future<list> to
// facilitate chaining.
@@ -1766,20 +1768,19 @@ void MesosContainerizerProcess::____destroy(
}
provisioner->destroy(containerId)
- .onAny(defer(self(),
- &Self::_____destroy,
- containerId,
- status,
- lambda::_1,
- message));
+ .onAny(defer(
+ self(),
+ &Self::_____destroy,
+ containerId,
+ status,
+ lambda::_1));
}
void MesosContainerizerProcess::_____destroy(
const ContainerID& containerId,
const Future<Option<int>>& status,
- const Future<bool>& destroy,
- Option<string> message)
+ const Future<bool>& destroy)
{
CHECK(containers_.contains(containerId));
@@ -1822,15 +1823,9 @@ void MesosContainerizerProcess::_____destroy(
}
}
- message = strings::join("; ", messages);
- }
-
- if (message.isNone()) {
- message = "Executor terminated";
+ termination.set_message(strings::join("; ", messages));
}
- termination.set_message(message.get());
-
container->promise.set(termination);
containers_.erase(containerId);
http://git-wip-us.apache.org/repos/asf/mesos/blob/ba435cc2/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 1f414cf..681ee00 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -234,23 +234,20 @@ private:
// Continues '__destroy()' once we get the exit status of the executor.
void ___destroy(
const ContainerID& containerId,
- const process::Future<Option<int>>& status,
- const Option<std::string>& message);
+ const process::Future<Option<int>>& status);
// Continues '___destroy()' once all isolators have completed
// cleanup.
void ____destroy(
const ContainerID& containerId,
const process::Future<Option<int>>& status,
- const process::Future<std::list<process::Future<Nothing>>>& cleanups,
- Option<std::string> message);
+ const process::Future<std::list<process::Future<Nothing>>>& cleanups);
// Continues '____destroy()' once provisioner have completed destroy.
void _____destroy(
const ContainerID& containerId,
const process::Future<Option<int>>& status,
- const process::Future<bool>& destroy,
- Option<std::string> message);
+ const process::Future<bool>& destroy);
// Call back for when an isolator limits a container and impacts the
// processes. This will trigger container destruction.
http://git-wip-us.apache.org/repos/asf/mesos/blob/ba435cc2/src/tests/containerizer/mesos_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/mesos_containerizer_tests.cpp b/src/tests/containerizer/mesos_containerizer_tests.cpp
index c0dda11..b501ccb 100644
--- a/src/tests/containerizer/mesos_containerizer_tests.cpp
+++ b/src/tests/containerizer/mesos_containerizer_tests.cpp
@@ -747,10 +747,6 @@ TEST_F(MesosContainerizerDestroyTest, DestroyWhilePreparing)
ContainerTermination termination = wait.get();
- EXPECT_EQ(
- "Container destroyed while preparing isolators",
- termination.message());
-
EXPECT_FALSE(termination.has_status());
}
@@ -862,10 +858,6 @@ TEST_F(MesosContainerizerProvisionerTest, ProvisionFailed)
ContainerTermination termination = wait.get();
- EXPECT_EQ(
- "Container destroyed while provisioning images",
- termination.message());
-
EXPECT_FALSE(termination.has_status());
}
@@ -960,10 +952,6 @@ TEST_F(MesosContainerizerProvisionerTest, DestroyWhileProvisioning)
ContainerTermination termination = wait.get();
- EXPECT_EQ(
- "Container destroyed while provisioning images",
- termination.message());
-
EXPECT_FALSE(termination.has_status());
}
@@ -1063,10 +1051,6 @@ TEST_F(MesosContainerizerProvisionerTest, IsolatorCleanupBeforePrepare)
ContainerTermination termination = wait.get();
- EXPECT_EQ(
- "Container destroyed while provisioning images",
- termination.message());
-
EXPECT_FALSE(termination.has_status());
}
[6/8] mesos git commit: Fixed the using statements in
MesosContainerizer.
Posted by ji...@apache.org.
Fixed the using statements in MesosContainerizer.
Review: https://reviews.apache.org/r/51414
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a910aba7
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a910aba7
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a910aba7
Branch: refs/heads/master
Commit: a910aba7efbf1988fa5af32b409aca703afe215f
Parents: 72c9f2d
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 20:22:52 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 25 ++++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/a910aba7/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 7a0b4ba..ccc66c7 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -118,17 +118,24 @@
#include "slave/containerizer/mesos/launch.hpp"
#include "slave/containerizer/mesos/provisioner/provisioner.hpp"
+using process::collect;
+using process::dispatch;
+using process::defer;
+
+using process::Failure;
+using process::Future;
+using process::Owned;
+
using std::list;
using std::map;
using std::set;
using std::string;
using std::vector;
-using namespace process;
-
-namespace mesos {
-namespace internal {
-namespace slave {
+using mesos::internal::slave::state::SlaveState;
+using mesos::internal::slave::state::FrameworkState;
+using mesos::internal::slave::state::ExecutorState;
+using mesos::internal::slave::state::RunState;
using mesos::modules::ModuleManager;
@@ -140,11 +147,9 @@ using mesos::slave::ContainerState;
using mesos::slave::ContainerTermination;
using mesos::slave::Isolator;
-using state::SlaveState;
-using state::FrameworkState;
-using state::ExecutorState;
-using state::RunState;
-
+namespace mesos {
+namespace internal {
+namespace slave {
Try<MesosContainerizer*> MesosContainerizer::create(
const Flags& flags,
[4/8] mesos git commit: Printed all the isolator cleanup errors
during destory.
Posted by ji...@apache.org.
Printed all the isolator cleanup errors during destory.
The current code only prints the first error.
Review: https://reviews.apache.org/r/51409
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/72c9f2de
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/72c9f2de
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/72c9f2de
Branch: refs/heads/master
Commit: 72c9f2deef6d306265c8209bf9a9711fde9756dc
Parents: 627c646
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 18:35:11 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 28 ++++++++++++--------
1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/72c9f2de/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 0b82a47..7a0b4ba 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1727,19 +1727,26 @@ void MesosContainerizerProcess::____destroy(
const Owned<Container>& container = containers_[containerId];
// Check cleanup succeeded for all isolators. If not, we'll fail the
- // container termination and remove the 'destroying' flag but leave
- // all other state. The container is now in an inconsistent state.
+ // container termination and remove the container from the map.
+ vector<string> errors;
+
foreach (const Future<Nothing>& cleanup, cleanups.get()) {
if (!cleanup.isReady()) {
- container->promise.fail(
- "Failed to clean up an isolator when destroying container: " +
- (cleanup.isFailed() ? cleanup.failure() : "discarded"));
+ errors.push_back(cleanup.isFailed()
+ ? cleanup.failure()
+ : "discarded");
+ }
+ }
- containers_.erase(containerId);
+ if (!errors.empty()) {
+ container->promise.fail(
+ "Failed to clean up an isolator when destroying container: " +
+ strings::join("; ", errors));
- ++metrics.container_destroy_errors;
- return;
- }
+ containers_.erase(containerId);
+
+ ++metrics.container_destroy_errors;
+ return;
}
provisioner->destroy(containerId)
@@ -1757,8 +1764,7 @@ void MesosContainerizerProcess::_____destroy(
if (!destroy.isReady()) {
container->promise.fail(
- "Failed to destroy the provisioned filesystem when destroying "
- "container '" + stringify(containerId) + "': " +
+ "Failed to destroy the provisioned rootfs when destroying container: " +
(destroy.isFailed() ? destroy.failure() : "discarded future"));
containers_.erase(containerId);
[8/8] mesos git commit: A few consistency fix on indentation.
Posted by ji...@apache.org.
A few consistency fix on indentation.
Review: https://reviews.apache.org/r/51415
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1bd974b0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1bd974b0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1bd974b0
Branch: refs/heads/master
Commit: 1bd974b0f69584d961826b2c53b8780d67c569ee
Parents: a910aba
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 20:30:22 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 32 +++++++++++---------
1 file changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1bd974b0/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index ccc66c7..f72d734 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -447,7 +447,9 @@ MesosContainerizer::~MesosContainerizer()
Future<Nothing> MesosContainerizer::recover(
const Option<state::SlaveState>& state)
{
- return dispatch(process.get(), &MesosContainerizerProcess::recover, state);
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::recover,
+ state);
}
@@ -521,42 +523,42 @@ Future<Nothing> MesosContainerizer::update(
Future<ResourceStatistics> MesosContainerizer::usage(
const ContainerID& containerId)
{
- return dispatch(
- process.get(),
- &MesosContainerizerProcess::usage,
- containerId);
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::usage,
+ containerId);
}
Future<ContainerStatus> MesosContainerizer::status(
const ContainerID& containerId)
{
- return dispatch(
- process.get(),
- &MesosContainerizerProcess::status,
- containerId);
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::status,
+ containerId);
}
Future<ContainerTermination> MesosContainerizer::wait(
const ContainerID& containerId)
{
- return dispatch(process.get(), &MesosContainerizerProcess::wait, containerId);
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::wait,
+ containerId);
}
void MesosContainerizer::destroy(const ContainerID& containerId)
{
- dispatch(
- process.get(),
- &MesosContainerizerProcess::destroy,
- containerId);
+ dispatch(process.get(),
+ &MesosContainerizerProcess::destroy,
+ containerId);
}
Future<hashset<ContainerID>> MesosContainerizer::containers()
{
- return dispatch(process.get(), &MesosContainerizerProcess::containers);
+ return dispatch(process.get(),
+ &MesosContainerizerProcess::containers);
}