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 2018/06/26 16:06:25 UTC
[1/2] mesos git commit: Updated CNI slave recovery test.
Repository: mesos
Updated Branches:
refs/heads/master 784825b33 -> 018695b88
Updated CNI slave recovery test.
Updated the test so that it can catch regression described in
MESOS-9025. This test fails without the fix for MESOS-9025 and passes
after the fix.
Review: https://reviews.apache.org/r/67737
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/018695b8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/018695b8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/018695b8
Branch: refs/heads/master
Commit: 018695b88a6ada5e90cae966f9cc4696d4612984
Parents: 230b868
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Jun 25 22:35:34 2018 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Jun 26 09:06:18 2018 -0700
----------------------------------------------------------------------
src/tests/containerizer/cni_isolator_tests.cpp | 41 +++++++++++++++++++++
1 file changed, 41 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/018695b8/src/tests/containerizer/cni_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/cni_isolator_tests.cpp b/src/tests/containerizer/cni_isolator_tests.cpp
index b58a9ca..b282e10 100644
--- a/src/tests/containerizer/cni_isolator_tests.cpp
+++ b/src/tests/containerizer/cni_isolator_tests.cpp
@@ -505,6 +505,33 @@ TEST_F(CniIsolatorTest, ROOT_FailedPlugin)
// kill the task and then verify we can receive TASK_KILLED for the task.
TEST_F(CniIsolatorTest, ROOT_SlaveRecovery)
{
+ // This file will be touched when CNI delete is called.
+ const string cniDeleteSignalFile = path::join(sandbox.get(), "delete");
+
+ Try<net::IP::Network> hostNetwork = getNonLoopbackIP();
+ ASSERT_SOME(hostNetwork);
+
+ Try<string> mockPlugin = strings::format(
+ R"~(
+ #!/bin/sh
+ if [ x$CNI_COMMAND = xADD ]; then
+ echo '{'
+ echo ' "ip4": {'
+ echo ' "ip": "%s/%d"'
+ echo ' }'
+ echo '}'
+ else
+ touch %s
+ fi
+ )~",
+ hostNetwork->address(),
+ hostNetwork->prefix(),
+ cniDeleteSignalFile);
+
+ ASSERT_SOME(mockPlugin);
+
+ ASSERT_SOME(setupMockPlugin(mockPlugin.get()));
+
Try<Owned<cluster::Master>> master = StartMaster();
ASSERT_SOME(master);
@@ -591,10 +618,24 @@ TEST_F(CniIsolatorTest, ROOT_SlaveRecovery)
// Stop the slave after TASK_RUNNING is received.
slave.get()->terminate();
+ Future<ReregisterExecutorMessage> reregisterExecutorMessage =
+ FUTURE_PROTOBUF(ReregisterExecutorMessage(), _, _);
+
// Restart the slave.
slave = StartSlave(detector.get(), flags);
ASSERT_SOME(slave);
+ AWAIT_READY(reregisterExecutorMessage);
+
+ Clock::pause();
+ Clock::advance(flags.executor_reregistration_timeout);
+ Clock::settle();
+ Clock::resume();
+
+ // NOTE: CNI DEL command should not be called. This is used to
+ // capture the regression described in MESOS-9025.
+ ASSERT_FALSE(os::exists(cniDeleteSignalFile));
+
// Kill the task.
driver.killTask(task.task_id());
[2/2] mesos git commit: Fixed orphan container cleanup issue in CNI
isolator.
Posted by ji...@apache.org.
Fixed orphan container cleanup issue in CNI isolator.
The bug was introduced in https://reviews.apache.org/r/65987/ when we
want to allow nested container to have a separate network namespace than
its parent (MESOS-8534).
The original code misses a `continue` statement after recovering regular
containers.
I am surprised that the unit tests didn't catch the bug. We'll add a new
unit test for catching the regression.
Review: https://reviews.apache.org/r/67728
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/230b8689
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/230b8689
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/230b8689
Branch: refs/heads/master
Commit: 230b8689b380043c30d1db18af8f7a9380f4ceeb
Parents: 784825b
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Jun 25 11:48:07 2018 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Jun 26 09:06:18 2018 -0700
----------------------------------------------------------------------
.../mesos/isolators/network/cni/cni.cpp | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/230b8689/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
index b6ad4fc..dfa26c6 100644
--- a/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
+++ b/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp
@@ -426,17 +426,15 @@ Future<Nothing> NetworkCniIsolatorProcess::recover(
"Failed to recover CNI network information for the orphaned "
"container " + stringify(containerId) + ": " + recover.error());
}
- }
-
- // Known orphan containers will be cleaned up by containerizer
- // using the normal cleanup path. See MESOS-2367 for details.
- if (orphans.contains(containerId)) {
- continue;
- }
- LOG(INFO) << "Removing unknown orphaned container " << containerId;
+ // Known orphan containers will be cleaned up by containerizer
+ // using the normal cleanup path. See MESOS-2367 for details.
+ if (!orphans.contains(containerId)) {
+ LOG(INFO) << "Removing unknown orphaned container " << containerId;
- cleanup(containerId);
+ cleanup(containerId);
+ }
+ }
}
return Nothing();