mesos git commit: Fixed a typo in `CpuIsolatorTest.ROOT_SystemCpuUsage`.
Repository: mesos Updated Branches: refs/heads/master 6cb80549b -> 0a1a79adf Fixed a typo in `CpuIsolatorTest.ROOT_SystemCpuUsage`. Review: https://reviews.apache.org/r/51878/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0a1a79ad Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0a1a79ad Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0a1a79ad Branch: refs/heads/master Commit: 0a1a79adfb216b6a28225f0c3cbafce35f70d8d8 Parents: 6cb8054 Author: haosdent huangAuthored: Tue Sep 13 19:24:30 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 19:24:30 2016 -0700 -- src/tests/containerizer/cpu_isolator_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/0a1a79ad/src/tests/containerizer/cpu_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cpu_isolator_tests.cpp b/src/tests/containerizer/cpu_isolator_tests.cpp index 39a6f77..b16cde3 100644 --- a/src/tests/containerizer/cpu_isolator_tests.cpp +++ b/src/tests/containerizer/cpu_isolator_tests.cpp @@ -242,7 +242,7 @@ TEST_P(CpuIsolatorTest, ROOT_SystemCpuUsage) waited += Milliseconds(200); } while (waited < Seconds(1)); - EXPECT_LE(0.125, statistics.cpus_user_time_secs()); + EXPECT_LE(0.125, statistics.cpus_system_time_secs()); driver.stop(); driver.join();
mesos git commit: Fixed the broken build on Mac OS.
Repository: mesos Updated Branches: refs/heads/master 9f73082aa -> 6cb80549b Fixed the broken build on Mac OS. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6cb80549 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6cb80549 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6cb80549 Branch: refs/heads/master Commit: 6cb80549bd8be31a85f06204edb5d5759811203e Parents: 9f73082 Author: Jie YuAuthored: Tue Sep 13 17:21:11 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 17:21:19 2016 -0700 -- src/tests/containerizer/cpu_isolator_tests.cpp| 14 +- src/tests/containerizer/memory_isolator_tests.cpp | 14 +- 2 files changed, 18 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/6cb80549/src/tests/containerizer/cpu_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cpu_isolator_tests.cpp b/src/tests/containerizer/cpu_isolator_tests.cpp index c8755f1..39a6f77 100644 --- a/src/tests/containerizer/cpu_isolator_tests.cpp +++ b/src/tests/containerizer/cpu_isolator_tests.cpp @@ -50,14 +50,18 @@ class CpuIsolatorTest // These tests are parameterized by the isolation flag. +static vector* isolators = new vector({ + "posix/cpu", +#ifdef __linux__ + "cgroups/cpu", +#endif // __linux__ +}); + + INSTANTIATE_TEST_CASE_P( IsolationFlag, CpuIsolatorTest, -#ifdef __linux__ -::testing::Values("posix/cpu", "cgroups/cpu")); -#else -::testing::Values("posix/cpu")); -#endif // __linux__ +::testing::ValuesIn(*isolators)); TEST_P(CpuIsolatorTest, ROOT_UserCpuUsage) http://git-wip-us.apache.org/repos/asf/mesos/blob/6cb80549/src/tests/containerizer/memory_isolator_tests.cpp -- diff --git a/src/tests/containerizer/memory_isolator_tests.cpp b/src/tests/containerizer/memory_isolator_tests.cpp index 7413ea0..62cffa7 100644 --- a/src/tests/containerizer/memory_isolator_tests.cpp +++ b/src/tests/containerizer/memory_isolator_tests.cpp @@ -50,14 +50,18 @@ class MemoryIsolatorTest // These tests are parameterized by the isolation flag. +static vector* isolators = new vector({ + "posix/mem", +#ifdef __linux__ + "cgroups/mem", +#endif // __linux__ +}); + + INSTANTIATE_TEST_CASE_P( IsolationFlag, MemoryIsolatorTest, -#ifdef __linux__ -::testing::Values("posix/mem", "cgroups/mem")); -#else -::testing::Values("posix/mem")); -#endif // __linux__ +::testing::ValuesIn(*isolators)); TEST_P(MemoryIsolatorTest, ROOT_MemUsage)
mesos git commit: Updated master validation for DOCKER ContainerInfo in TaskGroup.
Repository: mesos Updated Branches: refs/heads/master aeaec8940 -> 9f73082aa Updated master validation for DOCKER ContainerInfo in TaskGroup. DOCKER as ContainerInfo Type for both task group executor as well as taskgroup task is currently not supported. Only MESOS as ContainerInfo Type is supported. This patch is to validate that TaskGroup executor and tasks do not use DOCKER ContainerInfo. Review: https://reviews.apache.org/r/51771/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9f73082a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9f73082a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9f73082a Branch: refs/heads/master Commit: 9f73082aac613f7430b0d713a672bcae90198c47 Parents: aeaec89 Author: Abhishek DasguptaAuthored: Tue Sep 13 17:00:37 2016 -0700 Committer: Vinod Kone Committed: Tue Sep 13 17:00:37 2016 -0700 -- src/master/validation.cpp | 15 ++- src/tests/master_validation_tests.cpp | 183 + 2 files changed, 196 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/9f73082a/src/master/validation.cpp -- diff --git a/src/master/validation.cpp b/src/master/validation.cpp index 137b9f9..aa743d7 100644 --- a/src/master/validation.cpp +++ b/src/master/validation.cpp @@ -1011,8 +1011,14 @@ Option validateTask( return Error("'TaskInfo.executor' must not be set"); } - if (task.has_container() && task.container().network_infos().size() > 0) { -return Error("NetworkInfos must not be set on the task"); + if (task.has_container()) { +if (task.container().network_infos().size() > 0) { + return Error("NetworkInfos must not be set on the task"); +} + +if (task.container().type() == ContainerInfo::DOCKER) { + return Error("Docker ContainerInfo is not supported on the task"); +} } return None(); @@ -1072,6 +1078,11 @@ Option validateExecutor( return Error("Unknown executor type"); } + if (executor.has_container() && + executor.container().type() == ContainerInfo::DOCKER) { +return Error("Docker ContainerInfo is not supported on the executor"); + } + const Resources& executorResources = executor.resources(); // Validate minimal cpus and memory resources of executor. http://git-wip-us.apache.org/repos/asf/mesos/blob/9f73082a/src/tests/master_validation_tests.cpp -- diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp index 3a5cfa2..16c5773 100644 --- a/src/tests/master_validation_tests.cpp +++ b/src/tests/master_validation_tests.cpp @@ -1719,6 +1719,98 @@ TEST_F(TaskGroupValidationTest, TaskGroupAndExecutorUsesRevocableResources) } +// Verifies that an executor with `ContainerInfo` set as DOCKER +// is rejected during `TaskGroupInfo` validation. +TEST_F(TaskGroupValidationTest, ExecutorUsesDockerContainerInfo) +{ + Try master = StartMaster(); + ASSERT_SOME(master); + + Owned detector = master.get()->createDetector(); + Try slave = StartSlave(detector.get()); + ASSERT_SOME(slave); + + FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO; + frameworkInfo.mutable_id()->set_value("Test_Framework"); + + MockScheduler sched; + MesosSchedulerDriver driver( + , frameworkInfo, master.get()->pid, DEFAULT_CREDENTIAL); + + EXPECT_CALL(sched, registered(, _, _)) +.Times(1); + + Future offers; + EXPECT_CALL(sched, resourceOffers(, _)) +.WillOnce(FutureArg<1>()) +.WillRepeatedly(Return()); // Ignore subsequent offers. + + driver.start(); + + AWAIT_READY(offers); + EXPECT_NE(0u, offers->size()); + + Offer offer = offers.get()[0]; + + // Create an invalid executor with `ContainerInfo` set as DOCKER. + ExecutorInfo executor; + executor.set_type(ExecutorInfo::DEFAULT); + executor.mutable_executor_id()->set_value("E"); + executor.mutable_framework_id()->CopyFrom(frameworkInfo.id()); + executor.mutable_container()->set_type(ContainerInfo::DOCKER); + + TaskInfo task1; + task1.set_name("1"); + task1.mutable_task_id()->set_value("1"); + task1.mutable_slave_id()->MergeFrom(offer.slave_id()); + task1.mutable_resources()->MergeFrom(offer.resources()); + + TaskInfo task2; + task2.set_name("2"); + task2.mutable_task_id()->set_value("2"); + task2.mutable_slave_id()->MergeFrom(offer.slave_id()); + task2.mutable_resources()->MergeFrom(offer.resources()); + + TaskGroupInfo taskGroup; + taskGroup.add_tasks()->CopyFrom(task1); + taskGroup.add_tasks()->CopyFrom(task2); + + Future task1Status; + Future task2Status; + EXPECT_CALL(sched, statusUpdate(, _)) +
mesos git commit: Revert "Entered working directory before switch user."
Repository: mesos Updated Branches: refs/heads/master c09214e52 -> aeaec8940 Revert "Entered working directory before switch user." This reverts commit d25cafa30af94323fbd17dd220d7fdf7563e2f2a. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aeaec894 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aeaec894 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aeaec894 Branch: refs/heads/master Commit: aeaec8940c7dd8e17e379fc7aa03fbce60d77b20 Parents: c09214e Author: Jie YuAuthored: Tue Sep 13 16:41:29 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 16:41:29 2016 -0700 -- src/slave/containerizer/mesos/launch.cpp | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/aeaec894/src/slave/containerizer/mesos/launch.cpp -- diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp index 0feaed1..b8ad27e 100644 --- a/src/slave/containerizer/mesos/launch.cpp +++ b/src/slave/containerizer/mesos/launch.cpp @@ -377,16 +377,6 @@ int MesosContainerizerLaunch::execute() } } - if (flags.working_directory.isSome()) { -Try chdir = os::chdir(flags.working_directory.get()); -if (chdir.isError()) { - cerr << "Failed to chdir into current working directory " - << "'" << flags.working_directory.get() << "': " - << chdir.error() << endl; - return EXIT_FAILURE; -} - } - // Change user if provided. Note that we do that after executing the // preparation commands so that those commands will be run with the // same privilege as the mesos-agent. @@ -461,6 +451,16 @@ int MesosContainerizerLaunch::execute() } #endif // __linux__ + if (flags.working_directory.isSome()) { +Try chdir = os::chdir(flags.working_directory.get()); +if (chdir.isError()) { + cerr << "Failed to chdir into current working directory " + << "'" << flags.working_directory.get() << "': " + << chdir.error() << endl; + return EXIT_FAILURE; +} + } + // Relay the environment variables. // TODO(jieyu): Consider using a clean environment.
mesos git commit: Removed unneeded `Resources::add/remove(const Resource&)`.
Repository: mesos Updated Branches: refs/heads/master 87e70888e -> c09214e52 Removed unneeded `Resources::add/remove(const Resource&)`. We can remove these given that they already call `Resources::add/remove(const Resource_&)` internally and a Resource is implicitly convertible to a Resource_. Review: https://reviews.apache.org/r/51850 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c09214e5 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c09214e5 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c09214e5 Branch: refs/heads/master Commit: c09214e52abe92e648b933d61c8a6b820a2036c6 Parents: 87e7088 Author: Jiang Yan XuAuthored: Tue Sep 6 14:26:28 2016 -0700 Committer: Jiang Yan Xu Committed: Tue Sep 13 16:06:33 2016 -0700 -- include/mesos/resources.hpp| 8 include/mesos/v1/resources.hpp | 8 src/common/resources.cpp | 12 src/v1/resources.cpp | 12 4 files changed, 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/c09214e5/include/mesos/resources.hpp -- diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp index 87828aa..7ba422d 100644 --- a/include/mesos/resources.hpp +++ b/include/mesos/resources.hpp @@ -500,14 +500,6 @@ private: // returns Resources. Option find(const Resource& target) const; - // Validation-free versions of += and -= `Resource` operators. - // These can be used when `r` is already validated. - void add(const Resource& r); - void subtract(const Resource& r); - - // The add and subtract methods and operators on Resource_ are only - // allowed from within Resources class so we hide them. - // Validation-free versions of += and -= `Resource_` operators. // These can be used when `r` is already validated. void add(const Resource_& r); http://git-wip-us.apache.org/repos/asf/mesos/blob/c09214e5/include/mesos/v1/resources.hpp -- diff --git a/include/mesos/v1/resources.hpp b/include/mesos/v1/resources.hpp index 27bdd27..add48c7 100644 --- a/include/mesos/v1/resources.hpp +++ b/include/mesos/v1/resources.hpp @@ -500,14 +500,6 @@ private: // returns Resources. Option find(const Resource& target) const; - // Validation-free versions of += and -= `Resource` operators. - // These can be used when `r` is already validated. - void add(const Resource& r); - void subtract(const Resource& r); - - // The add and subtract methods and operators on Resource_ are only - // allowed from within Resources class so we hide them. - // Validation-free versions of += and -= `Resource_` operators. // These can be used when `r` is already validated. void add(const Resource_& r); http://git-wip-us.apache.org/repos/asf/mesos/blob/c09214e5/src/common/resources.cpp -- diff --git a/src/common/resources.cpp b/src/common/resources.cpp index 77ee921..f841e91 100644 --- a/src/common/resources.cpp +++ b/src/common/resources.cpp @@ -1597,12 +1597,6 @@ void Resources::add(const Resource_& that) } -void Resources::add(const Resource& that) -{ - add(Resource_(that)); -} - - Resources& Resources::operator+=(const Resource_& that) { if (that.validate().isNone()) { @@ -1695,12 +1689,6 @@ void Resources::subtract(const Resource_& that) } -void Resources::subtract(const Resource& that) -{ - subtract(Resource_(that)); -} - - Resources& Resources::operator-=(const Resource_& that) { if (that.validate().isNone()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/c09214e5/src/v1/resources.cpp -- diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp index 4ba5bf8..4410a8f 100644 --- a/src/v1/resources.cpp +++ b/src/v1/resources.cpp @@ -1600,12 +1600,6 @@ void Resources::add(const Resource_& that) } -void Resources::add(const Resource& that) -{ - add(Resource_(that)); -} - - Resources& Resources::operator+=(const Resource_& that) { if (that.validate().isNone()) { @@ -1698,12 +1692,6 @@ void Resources::subtract(const Resource_& that) } -void Resources::subtract(const Resource& that) -{ - subtract(Resource_(that)); -} - - Resources& Resources::operator-=(const Resource_& that) { if (that.validate().isNone()) {
[3/4] mesos git commit: Libprocess: Fixed includes for UNREACHABLE() macro.
Libprocess: Fixed includes for UNREACHABLE() macro. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/34989d59 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/34989d59 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/34989d59 Branch: refs/heads/master Commit: 34989d59f10477b77bd48ac273a0838797aaeee4 Parents: 4e7d2fa Author: Alexander RukletsovAuthored: Wed Sep 14 00:32:03 2016 +0200 Committer: Alexander Rukletsov Committed: Wed Sep 14 00:41:58 2016 +0200 -- 3rdparty/libprocess/src/process.cpp| 1 - 3rdparty/libprocess/src/subprocess_posix.cpp | 1 - 3rdparty/libprocess/src/subprocess_windows.cpp | 1 - 3 files changed, 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/34989d59/3rdparty/libprocess/src/process.cpp -- diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp index a6fbf92..1e48fd5 100644 --- a/3rdparty/libprocess/src/process.cpp +++ b/3rdparty/libprocess/src/process.cpp @@ -101,7 +101,6 @@ #include #include #include -#include #include "authenticator_manager.hpp" #include "config.hpp" http://git-wip-us.apache.org/repos/asf/mesos/blob/34989d59/3rdparty/libprocess/src/subprocess_posix.cpp -- diff --git a/3rdparty/libprocess/src/subprocess_posix.cpp b/3rdparty/libprocess/src/subprocess_posix.cpp index 8f2352d..1927141 100644 --- a/3rdparty/libprocess/src/subprocess_posix.cpp +++ b/3rdparty/libprocess/src/subprocess_posix.cpp @@ -31,7 +31,6 @@ #include #include #include -#include using std::map; using std::string; http://git-wip-us.apache.org/repos/asf/mesos/blob/34989d59/3rdparty/libprocess/src/subprocess_windows.cpp -- diff --git a/3rdparty/libprocess/src/subprocess_windows.cpp b/3rdparty/libprocess/src/subprocess_windows.cpp index d4713ec..20cad52 100644 --- a/3rdparty/libprocess/src/subprocess_windows.cpp +++ b/3rdparty/libprocess/src/subprocess_windows.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include using std::array;
[2/4] mesos git commit: Stout: Fixed includes for UNREACHABLE() macro.
Stout: Fixed includes for UNREACHABLE() macro. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4e7d2faf Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4e7d2faf Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4e7d2faf Branch: refs/heads/master Commit: 4e7d2faf07a7b7051d3a7dbb01d87676ab0c4fa7 Parents: ad5bca1 Author: Alexander RukletsovAuthored: Wed Sep 14 00:31:52 2016 +0200 Committer: Alexander Rukletsov Committed: Wed Sep 14 00:41:53 2016 +0200 -- 3rdparty/stout/include/stout/os.hpp | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/4e7d2faf/3rdparty/stout/include/stout/os.hpp -- diff --git a/3rdparty/stout/include/stout/os.hpp b/3rdparty/stout/include/stout/os.hpp index facf183..cb53c02 100644 --- a/3rdparty/stout/include/stout/os.hpp +++ b/3rdparty/stout/include/stout/os.hpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include
[1/4] mesos git commit: Fixed a typo in provisioner.cpp.
Repository: mesos Updated Branches: refs/heads/master cde295a14 -> 87e70888e Fixed a typo in provisioner.cpp. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ad5bca13 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ad5bca13 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ad5bca13 Branch: refs/heads/master Commit: ad5bca13eb90ce29afecc99b663e4acc26d0b2ed Parents: cde295a Author: Alexander RukletsovAuthored: Wed Sep 14 00:11:55 2016 +0200 Committer: Alexander Rukletsov Committed: Wed Sep 14 00:41:46 2016 +0200 -- src/slave/containerizer/mesos/provisioner/provisioner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/ad5bca13/src/slave/containerizer/mesos/provisioner/provisioner.cpp -- diff --git a/src/slave/containerizer/mesos/provisioner/provisioner.cpp b/src/slave/containerizer/mesos/provisioner/provisioner.cpp index a5e03b5..f37c45c 100644 --- a/src/slave/containerizer/mesos/provisioner/provisioner.cpp +++ b/src/slave/containerizer/mesos/provisioner/provisioner.cpp @@ -278,7 +278,7 @@ Future ProvisionerProcess::_provision( const ImageInfo& imageInfo) { // TODO(jieyu): Choose a backend smartly. For instance, if there is - // only one layer returned from the store. prefer to use bind + // only one layer returned from the store, prefer to use bind // backend because it's the simplest. const string& backend = flags.image_provisioner_backend; CHECK(backends.contains(backend));
mesos git commit: Fixed line wrap in executor.proto.
Repository: mesos Updated Branches: refs/heads/master 2d18088c2 -> cde295a14 Fixed line wrap in executor.proto. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cde295a1 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cde295a1 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cde295a1 Branch: refs/heads/master Commit: cde295a14df19854dda352ab90bad84631b78e16 Parents: 2d18088 Author: Vinod KoneAuthored: Tue Sep 13 15:20:48 2016 -0700 Committer: Vinod Kone Committed: Tue Sep 13 15:20:48 2016 -0700 -- include/mesos/v1/executor/executor.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/cde295a1/include/mesos/v1/executor/executor.proto -- diff --git a/include/mesos/v1/executor/executor.proto b/include/mesos/v1/executor/executor.proto index 0783596..f661b71 100644 --- a/include/mesos/v1/executor/executor.proto +++ b/include/mesos/v1/executor/executor.proto @@ -199,7 +199,8 @@ message Event { // Type of the call, indicates which optional field below should be // present if that type has a nested message definition. // In case type is SUBSCRIBED, no message needs to be set. - // See comments on `Event::Type` above on the reasoning behind this field being optional. + // See comments on `Event::Type` above on the reasoning behind this + // field being optional. optional Type type = 3; optional Subscribe subscribe = 4;
[1/2] mesos git commit: Added check in FileEncoder's destructor.
Repository: mesos Updated Branches: refs/heads/master 2987c2578 -> 2d18088c2 Added check in FileEncoder's destructor. This check will force libprocess to fail fast if a file descriptor is closed underneath it. Review: https://reviews.apache.org/r/51511/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0221ad8c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0221ad8c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0221ad8c Branch: refs/heads/master Commit: 0221ad8c59ab2f682a087810f21cbf98022e904a Parents: 2987c25 Author: Joseph WuAuthored: Tue Sep 13 14:11:50 2016 -0700 Committer: Joseph Wu Committed: Tue Sep 13 14:11:50 2016 -0700 -- 3rdparty/libprocess/src/encoder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/0221ad8c/3rdparty/libprocess/src/encoder.hpp -- diff --git a/3rdparty/libprocess/src/encoder.hpp b/3rdparty/libprocess/src/encoder.hpp index 9cd0d3f..af083d1 100644 --- a/3rdparty/libprocess/src/encoder.hpp +++ b/3rdparty/libprocess/src/encoder.hpp @@ -256,7 +256,7 @@ public: virtual ~FileEncoder() { -os::close(fd); +CHECK_SOME(os::close(fd)) << "Failed to close file descriptor"; } virtual Kind kind() const
[2/2] mesos git commit: Windows: Added missing include in docker/docker.cpp.
Windows: Added missing include in docker/docker.cpp. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2d18088c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2d18088c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2d18088c Branch: refs/heads/master Commit: 2d18088c238cd0668e5c8f06b6c1ff41eb87b7e2 Parents: 0221ad8 Author: Joseph WuAuthored: Tue Sep 13 13:11:22 2016 -0700 Committer: Joseph Wu Committed: Tue Sep 13 14:12:41 2016 -0700 -- src/docker/docker.cpp | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/2d18088c/src/docker/docker.cpp -- diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp index 3d55424..49a1b2f 100755 --- a/src/docker/docker.cpp +++ b/src/docker/docker.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include
mesos git commit: Fixed a compile warning in memory isolator tests.
Repository: mesos Updated Branches: refs/heads/master 8e727e091 -> 2987c2578 Fixed a compile warning in memory isolator tests. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2987c257 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2987c257 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2987c257 Branch: refs/heads/master Commit: 2987c2578208503bd45893d6928bf2a8e71840d5 Parents: 8e727e0 Author: Jie YuAuthored: Tue Sep 13 13:09:26 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 13:09:26 2016 -0700 -- src/tests/containerizer/memory_isolator_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/2987c257/src/tests/containerizer/memory_isolator_tests.cpp -- diff --git a/src/tests/containerizer/memory_isolator_tests.cpp b/src/tests/containerizer/memory_isolator_tests.cpp index 39f29f4..7413ea0 100644 --- a/src/tests/containerizer/memory_isolator_tests.cpp +++ b/src/tests/containerizer/memory_isolator_tests.cpp @@ -127,7 +127,7 @@ TEST_P(MemoryIsolatorTest, ROOT_MemUsage) // TODO(jieyu): Consider using a program that predictably increases // RSS so that we can set more meaningful expectation here. - EXPECT_GT(usage.get().mem_rss_bytes(), 0); + EXPECT_LT(0u, usage.get().mem_rss_bytes()); driver.stop(); driver.join();
[10/17] mesos git commit: Updated `NetClsCgroupsFilter` to use `NET_CLS_` to filter test cases.
Updated `NetClsCgroupsFilter` to use `NET_CLS_` to filter test cases. Review: https://reviews.apache.org/r/51781/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dcf48fe0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dcf48fe0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dcf48fe0 Branch: refs/heads/master Commit: dcf48fe041ba02d81238d069263e2323ab0c3df0 Parents: edf824b Author: haosdent huangAuthored: Mon Sep 12 16:34:54 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/tests/environment.cpp | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/dcf48fe0/src/tests/environment.cpp -- diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp index d5abfc9..a0dbfc2 100644 --- a/src/tests/environment.cpp +++ b/src/tests/environment.cpp @@ -437,10 +437,7 @@ public: bool disable(const ::testing::TestInfo* test) const { -if (matches(test, "NetClsIsolatorTest")) { - return netClsError; -} -return false; +return matches(test, "NET_CLS_") && netClsError; } private:
[13/17] mesos git commit: Refactored cpu isolator associated test cases.
Refactored cpu isolator associated test cases. Review: https://reviews.apache.org/r/51787/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/451f65fd Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/451f65fd Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/451f65fd Branch: refs/heads/master Commit: 451f65fdaf7953dcfcf865e093869540df890e0f Parents: e766d4d Author: haosdent huangAuthored: Mon Sep 12 16:35:02 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/Makefile.am | 1 + .../containerizer/cgroups_isolator_tests.cpp| 307 +++ src/tests/containerizer/cpu_isolator_tests.cpp | 249 +++ 3 files changed, 557 insertions(+) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/451f65fd/src/Makefile.am -- diff --git a/src/Makefile.am b/src/Makefile.am index e789994..5d38747 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2134,6 +2134,7 @@ mesos_tests_SOURCES = \ tests/common/type_utils_tests.cpp\ tests/containerizer/appc_spec_tests.cpp \ tests/containerizer/composing_containerizer_tests.cpp\ + tests/containerizer/cpu_isolator_tests.cpp \ tests/containerizer/docker_containerizer_tests.cpp \ tests/containerizer/docker_spec_tests.cpp\ tests/containerizer/docker_tests.cpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/451f65fd/src/tests/containerizer/cgroups_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp index 396c96c..75fe3b7 100644 --- a/src/tests/containerizer/cgroups_isolator_tests.cpp +++ b/src/tests/containerizer/cgroups_isolator_tests.cpp @@ -15,6 +15,7 @@ // limitations under the License. #include +#include #include #include @@ -36,6 +37,8 @@ using mesos::internal::slave::CGROUP_SUBSYSTEM_DEVICES_NAME; using mesos::internal::slave::CGROUP_SUBSYSTEM_MEMORY_NAME; using mesos::internal::slave::CGROUP_SUBSYSTEM_NET_CLS_NAME; using mesos::internal::slave::CGROUP_SUBSYSTEM_PERF_EVENT_NAME; +using mesos::internal::slave::CPU_SHARES_PER_CPU_REVOCABLE; +using mesos::internal::slave::DEFAULT_EXECUTOR_CPUS; using mesos::internal::slave::Fetcher; using mesos::internal::slave::MesosContainerizer; @@ -43,10 +46,13 @@ using mesos::master::detector::MasterDetector; using process::Future; using process::Owned; +using process::Queue; using std::string; using std::vector; +using testing::InvokeWithoutArgs; + namespace mesos { namespace internal { namespace tests { @@ -206,6 +212,307 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_PERF_NET_CLS_UserCgroup) driver.join(); } + +TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_RevocableCpu) +{ + Try master = StartMaster(); + ASSERT_SOME(master); + + slave::Flags flags = CreateSlaveFlags(); + flags.isolation = "cgroups/cpu"; + + Fetcher fetcher; + + Try _containerizer = +MesosContainerizer::create(flags, true, ); + + ASSERT_SOME(_containerizer); + + Owned containerizer(_containerizer.get()); + + MockResourceEstimator resourceEstimator; + EXPECT_CALL(resourceEstimator, initialize(_)); + + Queue estimations; + EXPECT_CALL(resourceEstimator, oversubscribable()) +.WillRepeatedly(InvokeWithoutArgs(, ::get)); + + Owned detector = master.get()->createDetector(); + + Try slave = StartSlave( + detector.get(), + containerizer.get(), + , + flags); + + ASSERT_SOME(slave); + + // Start the framework which accepts revocable resources. + FrameworkInfo frameworkInfo = DEFAULT_FRAMEWORK_INFO; + frameworkInfo.add_capabilities()->set_type( + FrameworkInfo::Capability::REVOCABLE_RESOURCES); + + MockScheduler sched; + MesosSchedulerDriver driver( + , + frameworkInfo, + master.get()->pid, + DEFAULT_CREDENTIAL); + + EXPECT_CALL(sched, registered(, _, _)) +.Times(1); + + Future offers1; + EXPECT_CALL(sched, resourceOffers(, _)) +.WillOnce(FutureArg<1>()); + + driver.start(); + + // Initially the framework will get all regular resources. + AWAIT_READY(offers1); + EXPECT_NE(0u, offers1.get().size()); + EXPECT_TRUE(Resources(offers1.get()[0].resources()).revocable().empty()); + + Future offers2; + EXPECT_CALL(sched, resourceOffers(, _)) +.WillOnce(FutureArg<1>()) +.WillRepeatedly(Return()); // Ignore subsequent offers. + + // Inject an
[01/17] mesos git commit: Renamed `CGROUPS_ROOT_PERF_RollForward` to keep consistency.
Repository: mesos Updated Branches: refs/heads/master f833169b4 -> 8e727e091 Renamed `CGROUPS_ROOT_PERF_RollForward` to keep consistency. Review: https://reviews.apache.org/r/51791/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8e727e09 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8e727e09 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8e727e09 Branch: refs/heads/master Commit: 8e727e09141fa569487b557cd8a1f8e388366dcb Parents: 08594c2 Author: haosdent huangAuthored: Mon Sep 12 16:35:17 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/tests/environment.cpp | 3 +-- src/tests/slave_recovery_tests.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/8e727e09/src/tests/environment.cpp -- diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp index 57ec492..fba94f6 100644 --- a/src/tests/environment.cpp +++ b/src/tests/environment.cpp @@ -590,9 +590,8 @@ public: { // Disable all tests that try to sample 'cpu-cycles' events using 'perf'. return (matches(test, "ROOT_CGROUPS_PERF_PerfTest") || -matches(test, "ROOT_CGROUPS_PERF_Sample") || matches(test, "ROOT_CGROUPS_PERF_UserCgroup") || -matches(test, "CGROUPS_ROOT_PERF_RollForward") || +matches(test, "ROOT_CGROUPS_PERF_RollForward") || matches(test, "ROOT_CGROUPS_PERF_Sample")) && perfError.isSome(); } http://git-wip-us.apache.org/repos/asf/mesos/blob/8e727e09/src/tests/slave_recovery_tests.cpp -- diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp index 3c69e56..d58d9bc 100644 --- a/src/tests/slave_recovery_tests.cpp +++ b/src/tests/slave_recovery_tests.cpp @@ -3878,7 +3878,7 @@ TEST_F(MesosContainerizerSlaveRecoveryTest, ResourceStatistics) // Test that the perf event isolator can be enabled on a new slave. // Previously created containers will not report perf statistics but // newly created containers will. -TEST_F(MesosContainerizerSlaveRecoveryTest, CGROUPS_ROOT_PERF_RollForward) +TEST_F(MesosContainerizerSlaveRecoveryTest, ROOT_CGROUPS_PERF_RollForward) { Try master = this->StartMaster(); ASSERT_SOME(master);
[11/17] mesos git commit: Entered working directory before switch user.
Entered working directory before switch user. If `chdir` into the working directory after switch user, the user may fail because of permissions problem. Review: https://reviews.apache.org/r/51782/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d25cafa3 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d25cafa3 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d25cafa3 Branch: refs/heads/master Commit: d25cafa30af94323fbd17dd220d7fdf7563e2f2a Parents: dcf48fe Author: haosdent huangAuthored: Mon Sep 12 16:34:57 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/slave/containerizer/mesos/launch.cpp | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/d25cafa3/src/slave/containerizer/mesos/launch.cpp -- diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp index b8ad27e..0feaed1 100644 --- a/src/slave/containerizer/mesos/launch.cpp +++ b/src/slave/containerizer/mesos/launch.cpp @@ -377,6 +377,16 @@ int MesosContainerizerLaunch::execute() } } + if (flags.working_directory.isSome()) { +Try chdir = os::chdir(flags.working_directory.get()); +if (chdir.isError()) { + cerr << "Failed to chdir into current working directory " + << "'" << flags.working_directory.get() << "': " + << chdir.error() << endl; + return EXIT_FAILURE; +} + } + // Change user if provided. Note that we do that after executing the // preparation commands so that those commands will be run with the // same privilege as the mesos-agent. @@ -451,16 +461,6 @@ int MesosContainerizerLaunch::execute() } #endif // __linux__ - if (flags.working_directory.isSome()) { -Try chdir = os::chdir(flags.working_directory.get()); -if (chdir.isError()) { - cerr << "Failed to chdir into current working directory " - << "'" << flags.working_directory.get() << "': " - << chdir.error() << endl; - return EXIT_FAILURE; -} - } - // Relay the environment variables. // TODO(jieyu): Consider using a clean environment.
[03/17] mesos git commit: Disabled perf test when perf version is not supported.
Disabled perf test when perf version is not supported. Review: https://reviews.apache.org/r/38528/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e766d4d1 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e766d4d1 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e766d4d1 Branch: refs/heads/master Commit: e766d4d191e762916194fd0bfb94b68a22dfa49f Parents: 0c3a227 Author: haosdent huangAuthored: Tue Sep 13 10:01:54 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/tests/environment.cpp | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/e766d4d1/src/tests/environment.cpp -- diff --git a/src/tests/environment.cpp b/src/tests/environment.cpp index a0dbfc2..57ec492 100644 --- a/src/tests/environment.cpp +++ b/src/tests/environment.cpp @@ -48,6 +48,7 @@ #ifdef __linux__ #include "linux/cgroups.hpp" #include "linux/fs.hpp" +#include "linux/perf.hpp" #endif #ifdef WITH_NETWORK_ISOLATOR @@ -555,11 +556,12 @@ public: PerfCPUCyclesFilter() { #ifdef __linux__ -bool perfUnavailable = os::system("perf help >&-") != 0; +bool perfUnavailable = !perf::supported(); if (perfUnavailable) { perfError = Error( - "The 'perf' command wasn't found so tests using it\n" - "to sample the 'cpu-cycles' hardware event will not be run."); + "Could not find the 'perf' command or its version lower that " + "2.6.39 so tests using it to sample the 'cpu-cycles' hardware " + "event will not be run."); } else { bool cyclesUnavailable = os::system("perf list hw | grep cpu-cycles >/dev/null") != 0; @@ -605,11 +607,11 @@ public: PerfFilter() { #ifdef __linux__ -perfError = os::system("perf help >&-") != 0; +perfError = !perf::supported(); if (perfError) { std::cerr << "-\n" -<< "No 'perf' command found so no 'perf' tests will be run\n" +<< "require 'perf' version >= 2.6.39 so no 'perf' tests will be run\n" << "-" << std::endl; }
[08/17] mesos git commit: Removed CgroupsNetClsIsolatorProcess.
Removed CgroupsNetClsIsolatorProcess. Review: https://reviews.apache.org/r/50750/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/34bcae44 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/34bcae44 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/34bcae44 Branch: refs/heads/master Commit: 34bcae442945bd7f3d7cd21b69c5ca133f3daef9 Parents: f75d949 Author: haosdent huangAuthored: Mon Sep 12 16:34:47 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/CMakeLists.txt | 1 - src/Makefile.am | 2 - src/slave/containerizer/mesos/containerizer.cpp | 1 - .../mesos/isolators/cgroups/net_cls.cpp | 500 --- .../mesos/isolators/cgroups/net_cls.hpp | 117 - src/tests/containerizer/isolator_tests.cpp | 314 src/tests/environment.cpp | 16 +- 7 files changed, 9 insertions(+), 942 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/34bcae44/src/CMakeLists.txt -- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4e66c74..7caa466 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,7 +159,6 @@ set(LINUX_SRC slave/containerizer/mesos/linux_launcher.cpp slave/containerizer/mesos/isolators/appc/runtime.cpp slave/containerizer/mesos/isolators/cgroups/cgroups.cpp - slave/containerizer/mesos/isolators/cgroups/net_cls.cpp slave/containerizer/mesos/isolators/cgroups/perf_event.cpp slave/containerizer/mesos/isolators/cgroups/subsystem.cpp slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp http://git-wip-us.apache.org/repos/asf/mesos/blob/34bcae44/src/Makefile.am -- diff --git a/src/Makefile.am b/src/Makefile.am index cf06c8d..d4b90f1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1025,7 +1025,6 @@ MESOS_LINUX_FILES = \ slave/containerizer/mesos/linux_launcher.cpp \ slave/containerizer/mesos/isolators/appc/runtime.cpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.cpp \ - slave/containerizer/mesos/isolators/cgroups/net_cls.cpp \ slave/containerizer/mesos/isolators/cgroups/perf_event.cpp \ slave/containerizer/mesos/isolators/cgroups/subsystem.cpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp \ @@ -1063,7 +1062,6 @@ MESOS_LINUX_FILES += \ slave/containerizer/mesos/isolators/appc/runtime.hpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.hpp \ slave/containerizer/mesos/isolators/cgroups/constants.hpp \ - slave/containerizer/mesos/isolators/cgroups/net_cls.hpp \ slave/containerizer/mesos/isolators/cgroups/perf_event.hpp \ slave/containerizer/mesos/isolators/cgroups/subsystem.hpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/34bcae44/src/slave/containerizer/mesos/containerizer.cpp -- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 69150e7..bbf5d53 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -73,7 +73,6 @@ #ifdef __linux__ #include "slave/containerizer/mesos/isolators/cgroups/cgroups.hpp" -#include "slave/containerizer/mesos/isolators/cgroups/net_cls.hpp" #include "slave/containerizer/mesos/isolators/cgroups/perf_event.hpp" #endif // __linux__ http://git-wip-us.apache.org/repos/asf/mesos/blob/34bcae44/src/slave/containerizer/mesos/isolators/cgroups/net_cls.cpp -- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/net_cls.cpp b/src/slave/containerizer/mesos/isolators/cgroups/net_cls.cpp deleted file mode 100644 index dcbc499..000 --- a/src/slave/containerizer/mesos/isolators/cgroups/net_cls.cpp +++ /dev/null @@ -1,500 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license
[12/17] mesos git commit: Refactored `UserCgroupsIsolatorTest`.
Refactored `UserCgroupsIsolatorTest`. Refactor `UserCgroupsIsolatorTest.ROOT_CGROUPS_PERF_UserCgroup` and rename to `CgroupsIsolatorTest.ROOT_CGROUPS_PERF_NET_CLS_UserCgroup`. Review: https://reviews.apache.org/r/51783/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/feb51147 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/feb51147 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/feb51147 Branch: refs/heads/master Commit: feb51147b5a5728447373304e4a2186b24a5b1ff Parents: d25cafa Author: haosdent huangAuthored: Mon Sep 12 16:34:59 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- .../containerizer/cgroups_isolator_tests.cpp| 179 ++- 1 file changed, 176 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/feb51147/src/tests/containerizer/cgroups_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp index c4e467c..396c96c 100644 --- a/src/tests/containerizer/cgroups_isolator_tests.cpp +++ b/src/tests/containerizer/cgroups_isolator_tests.cpp @@ -14,15 +14,39 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include -#include +#include +#include #include "slave/containerizer/mesos/containerizer.hpp" +#include "slave/containerizer/mesos/isolators/cgroups/constants.hpp" + +#include "tests/mesos.hpp" #include "tests/script.hpp" +#include "tests/containerizer/docker_archive.hpp" + +using mesos::internal::master::Master; + +using mesos::internal::slave::CGROUP_SUBSYSTEM_CPU_NAME; +using mesos::internal::slave::CGROUP_SUBSYSTEM_CPUACCT_NAME; +using mesos::internal::slave::CGROUP_SUBSYSTEM_DEVICES_NAME; +using mesos::internal::slave::CGROUP_SUBSYSTEM_MEMORY_NAME; +using mesos::internal::slave::CGROUP_SUBSYSTEM_NET_CLS_NAME; +using mesos::internal::slave::CGROUP_SUBSYSTEM_PERF_EVENT_NAME; +using mesos::internal::slave::Fetcher; +using mesos::internal::slave::MesosContainerizer; + +using mesos::master::detector::MasterDetector; + +using process::Future; +using process::Owned; + +using std::string; +using std::vector; + namespace mesos { namespace internal { namespace tests { @@ -33,6 +57,155 @@ TEST_SCRIPT(ContainerizerTest, ROOT_CGROUPS_BalloonFramework, "balloon_framework_test.sh") + +class CgroupsIsolatorTest : public MesosTest {}; + + +// This test starts the agent with cgroups isolation and launches a +// task with an unprivileged user. Then verifies that the unprivileged +// user has write permission under the corresponding cgroups which are +// prepared for the container to run the task. +TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_PERF_NET_CLS_UserCgroup) +{ + Try master = StartMaster(); + ASSERT_SOME(master); + + const string registry = path::join(os::getcwd(), "registry"); + + Future testImage = DockerArchive::create(registry, "alpine"); + AWAIT_READY(testImage); + + ASSERT_TRUE(os::exists(path::join(registry, "alpine.tar"))); + + slave::Flags flags = CreateSlaveFlags(); + flags.docker_registry = registry; + flags.docker_store_dir = path::join(os::getcwd(), "store"); + flags.image_providers = "docker"; + flags.perf_events = "cpu-cycles"; // Needed for `PerfEventSubsystem`. + flags.isolation = +"cgroups/cpu," +"cgroups/devices," +"cgroups/mem," +"cgroups/net_cls," +"cgroups/perf_event," +"docker/runtime," +"filesystem/linux"; + + Fetcher fetcher; + + Try _containerizer = +MesosContainerizer::create(flags, true, ); + + ASSERT_SOME(_containerizer); + + Owned containerizer(_containerizer.get()); + + Owned detector = master.get()->createDetector(); + + Try slave = StartSlave( + detector.get(), + containerizer.get()); + + ASSERT_SOME(slave); + + MockScheduler sched; + + MesosSchedulerDriver driver( + , + DEFAULT_FRAMEWORK_INFO, + master.get()->pid, + DEFAULT_CREDENTIAL); + + EXPECT_CALL(sched, registered(, _, _)) +.Times(1); + + Future offers; + EXPECT_CALL(sched, resourceOffers(, _)) +.WillOnce(FutureArg<1>()) +.WillRepeatedly(Return()); // Ignore subsequent offers. + + driver.start(); + + AWAIT_READY(offers); + EXPECT_NE(0u, offers.get().size()); + + // Launch a task with the command executor. + CommandInfo command; + command.set_shell(false); + command.set_value("/bin/sleep"); + command.add_arguments("sleep"); + command.add_arguments("120"); + command.set_user("nobody"); + + TaskInfo task = createTask( + offers.get()[0].slave_id(), +
[02/17] mesos git commit: Refactored the test cases for net_cls cgroups isolation.
Refactored the test cases for net_cls cgroups isolation. Review: https://reviews.apache.org/r/51789/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/665d4cc1 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/665d4cc1 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/665d4cc1 Branch: refs/heads/master Commit: 665d4cc103640de43c742268a84fd0816de6ca42 Parents: 612efe2 Author: haosdent huangAuthored: Mon Sep 12 16:35:11 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- .../containerizer/cgroups_isolator_tests.cpp| 324 +++ 1 file changed, 324 insertions(+) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/665d4cc1/src/tests/containerizer/cgroups_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp index 75fe3b7..4882af0 100644 --- a/src/tests/containerizer/cgroups_isolator_tests.cpp +++ b/src/tests/containerizer/cgroups_isolator_tests.cpp @@ -24,6 +24,8 @@ #include "slave/containerizer/mesos/isolators/cgroups/constants.hpp" +#include "slave/containerizer/mesos/isolators/cgroups/subsystems/net_cls.hpp" + #include "tests/mesos.hpp" #include "tests/script.hpp" @@ -41,6 +43,8 @@ using mesos::internal::slave::CPU_SHARES_PER_CPU_REVOCABLE; using mesos::internal::slave::DEFAULT_EXECUTOR_CPUS; using mesos::internal::slave::Fetcher; using mesos::internal::slave::MesosContainerizer; +using mesos::internal::slave::NetClsHandle; +using mesos::internal::slave::NetClsHandleManager; using mesos::master::detector::MasterDetector; @@ -48,6 +52,10 @@ using process::Future; using process::Owned; using process::Queue; +using process::http::OK; +using process::http::Response; + +using std::set; using std::string; using std::vector; @@ -513,6 +521,322 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_PidsAndTids) driver.join(); } + +class NetClsHandleManagerTest : public testing::Test {}; + + +// Tests the ability of the `NetClsHandleManager` class to allocate +// and free secondary handles from a range of primary handles. +TEST_F(NetClsHandleManagerTest, AllocateFreeHandles) +{ + NetClsHandleManager manager(IntervalSet( + (Bound::closed(0x0002), + Bound::closed(0x0003; + + Try handle = manager.alloc(0x0003); + ASSERT_SOME(handle); + + EXPECT_SOME_TRUE(manager.isUsed(handle.get())); + + ASSERT_SOME(manager.free(handle.get())); + + EXPECT_SOME_FALSE(manager.isUsed(handle.get())); +} + + +// Make sure allocation of secondary handles for invalid primary +// handles results in an error. +TEST_F(NetClsHandleManagerTest, AllocateInvalidPrimary) +{ + NetClsHandleManager manager(IntervalSet( + (Bound::closed(0x0002), + Bound::closed(0x0003; + + ASSERT_ERROR(manager.alloc(0x0001)); +} + + +// Tests that we can reserve secondary handles for a given primary +// handle so that they won't be allocated out later. +TEST_F(NetClsHandleManagerTest, ReserveHandles) +{ + NetClsHandleManager manager(IntervalSet( + (Bound::closed(0x0002), + Bound::closed(0x0003; + + NetClsHandle handle(0x0003, 0x); + + ASSERT_SOME(manager.reserve(handle)); + + EXPECT_SOME_TRUE(manager.isUsed(handle)); +} + + +// Tests that secondary handles are allocated only from a given range, +// when the range is specified. +TEST_F(NetClsHandleManagerTest, SecondaryHandleRange) +{ + NetClsHandleManager manager( + IntervalSet( +(Bound::closed(0x0002), + Bound::closed(0x0003))), + IntervalSet( +(Bound::closed(0x), + Bound::closed(0x; + + Try handle = manager.alloc(0x0003); + ASSERT_SOME(handle); + + EXPECT_SOME_TRUE(manager.isUsed(handle.get())); + + // Try allocating another handle. This should fail, since we don't + // have any more secondary handles left. + EXPECT_ERROR(manager.alloc(0x0003)); + + ASSERT_SOME(manager.free(handle.get())); + + ASSERT_SOME(manager.reserve(handle.get())); + + EXPECT_SOME_TRUE(manager.isUsed(handle.get())); + + // Make sure you cannot reserve a secondary handle that is out of + // range. + EXPECT_ERROR(manager.reserve(NetClsHandle(0x0003, 0x0001))); +} + + +// This tests the create, prepare, isolate and cleanup methods of the +// 'CgroupNetClsIsolatorProcess'. The test first creates a +// 'MesosContainerizer' with net_cls cgroup isolator enabled. The +// net_cls cgroup isolator is implemented in the +// 'CgroupNetClsIsolatorProcess' class. The test then launches a task +// in a mesos container and checks to see if the container has been +// added to the right net_cls cgroup. Finally, the test kills the task +// and makes sure that the
[05/17] mesos git commit: Enabled cgroups unified isolator in isolation.
Enabled cgroups unified isolator in isolation. Review: https://reviews.apache.org/r/49855/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e2fea326 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e2fea326 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e2fea326 Branch: refs/heads/master Commit: e2fea326de58bd60d6ca8513ffd4fb89cf2dce8d Parents: f833169 Author: haosdent huangAuthored: Mon Sep 12 16:34:33 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/slave/containerizer/mesos/containerizer.cpp | 25 1 file changed, 20 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/e2fea326/src/slave/containerizer/mesos/containerizer.cpp -- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 1a120f1..24b0585 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -72,6 +72,7 @@ #endif // __linux__ #ifdef __linux__ +#include "slave/containerizer/mesos/isolators/cgroups/cgroups.hpp" #include "slave/containerizer/mesos/isolators/cgroups/cpushare.hpp" #include "slave/containerizer/mesos/isolators/cgroups/devices.hpp" #include "slave/containerizer/mesos/isolators/cgroups/mem.hpp" @@ -326,11 +327,11 @@ Try MesosContainerizer::create( {"windows/cpu", ::create}, #endif // __WINDOWS__ #ifdef __linux__ -{"cgroups/cpu", ::create}, -{"cgroups/devices", ::create}, -{"cgroups/mem", ::create}, -{"cgroups/net_cls", ::create}, -{"cgroups/perf_event", ::create}, +{"cgroups/cpu", ::create}, +{"cgroups/devices", ::create}, +{"cgroups/mem", ::create}, +{"cgroups/net_cls", ::create}, +{"cgroups/perf_event", ::create}, {"appc/runtime", ::create}, {"docker/runtime", ::create}, {"docker/volume", ::create}, @@ -372,7 +373,21 @@ Try MesosContainerizer::create( vector isolators; + // Note: For cgroups, we only create `CgroupsIsolatorProcess` once. + // We use this flag to identify whether `CgroupsIsolatorProcess` has + // been created or not. + bool cgroupsIsolatorCreated = false; + foreach (const string& isolation, isolations) { +if (strings::startsWith(isolation, "cgroups/")) { + if (cgroupsIsolatorCreated) { +// Skip when `CgroupsIsolatorProcess` have been created. +continue; + } else { +cgroupsIsolatorCreated = true; + } +} + Try isolator = [&]() -> Try { if (creators.contains(isolation)) { return creators.at(isolation)(flags_);
[14/17] mesos git commit: Support changing the cgroup owner for command tasks that has rootfs.
Support changing the cgroup owner for command tasks that has rootfs. For command tasks that have rootfs defined, the command executor will be running as root. However, the task might want to manipulate cgroups. This patch allows that. Review: https://reviews.apache.org/r/51835 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0c3a227a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0c3a227a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0c3a227a Branch: refs/heads/master Commit: 0c3a227a5b71e9b8d4578fecedd819b76fbaca21 Parents: feb5114 Author: Jie YuAuthored: Mon Sep 12 21:33:34 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- .../mesos/isolators/cgroups/cgroups.cpp | 45 1 file changed, 36 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/0c3a227a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp -- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp index 8b6dfde..e87d055 100644 --- a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp +++ b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp @@ -404,16 +404,43 @@ Future
[09/17] mesos git commit: Removed CgroupsPerfEventIsolatorProcess.
Removed CgroupsPerfEventIsolatorProcess. Review: https://reviews.apache.org/r/50751/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/edf824b4 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/edf824b4 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/edf824b4 Branch: refs/heads/master Commit: edf824b4d95d44c33c7c381718594b01d0357712 Parents: 34bcae4 Author: haosdent huangAuthored: Mon Sep 12 16:34:51 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/CMakeLists.txt | 1 - src/Makefile.am | 2 - src/slave/containerizer/mesos/containerizer.cpp | 1 - .../mesos/isolators/cgroups/perf_event.cpp | 415 --- .../mesos/isolators/cgroups/perf_event.hpp | 118 -- src/tests/containerizer/isolator_tests.cpp | 232 --- 6 files changed, 769 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/edf824b4/src/CMakeLists.txt -- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7caa466..42c52b6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,7 +159,6 @@ set(LINUX_SRC slave/containerizer/mesos/linux_launcher.cpp slave/containerizer/mesos/isolators/appc/runtime.cpp slave/containerizer/mesos/isolators/cgroups/cgroups.cpp - slave/containerizer/mesos/isolators/cgroups/perf_event.cpp slave/containerizer/mesos/isolators/cgroups/subsystem.cpp slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp http://git-wip-us.apache.org/repos/asf/mesos/blob/edf824b4/src/Makefile.am -- diff --git a/src/Makefile.am b/src/Makefile.am index d4b90f1..e789994 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1025,7 +1025,6 @@ MESOS_LINUX_FILES = \ slave/containerizer/mesos/linux_launcher.cpp \ slave/containerizer/mesos/isolators/appc/runtime.cpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.cpp \ - slave/containerizer/mesos/isolators/cgroups/perf_event.cpp \ slave/containerizer/mesos/isolators/cgroups/subsystem.cpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp \ @@ -1062,7 +1061,6 @@ MESOS_LINUX_FILES += \ slave/containerizer/mesos/isolators/appc/runtime.hpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.hpp \ slave/containerizer/mesos/isolators/cgroups/constants.hpp \ - slave/containerizer/mesos/isolators/cgroups/perf_event.hpp \ slave/containerizer/mesos/isolators/cgroups/subsystem.hpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.hpp \ slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/edf824b4/src/slave/containerizer/mesos/containerizer.cpp -- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index bbf5d53..dc18e4e 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -73,7 +73,6 @@ #ifdef __linux__ #include "slave/containerizer/mesos/isolators/cgroups/cgroups.hpp" -#include "slave/containerizer/mesos/isolators/cgroups/perf_event.hpp" #endif // __linux__ #ifdef __linux__ http://git-wip-us.apache.org/repos/asf/mesos/blob/edf824b4/src/slave/containerizer/mesos/isolators/cgroups/perf_event.cpp -- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/perf_event.cpp b/src/slave/containerizer/mesos/isolators/cgroups/perf_event.cpp deleted file mode 100644 index 31f3538..000 --- a/src/slave/containerizer/mesos/isolators/cgroups/perf_event.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -//
[04/17] mesos git commit: Removed CgroupsDevicesIsolatorProcess.
Removed CgroupsDevicesIsolatorProcess. Review: https://reviews.apache.org/r/50749/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/dfd3690b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/dfd3690b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/dfd3690b Branch: refs/heads/master Commit: dfd3690b9bbede8cce0c25a4274acaa0bfdf5b83 Parents: c3d1f77 Author: haosdent huangAuthored: Mon Sep 12 16:34:40 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- src/CMakeLists.txt | 1 - src/Makefile.am | 2 - src/slave/containerizer/mesos/containerizer.cpp | 1 - .../mesos/isolators/cgroups/devices.cpp | 368 --- .../mesos/isolators/cgroups/devices.hpp | 98 - 5 files changed, 470 deletions(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd3690b/src/CMakeLists.txt -- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 414e723..aae8af8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,7 +159,6 @@ set(LINUX_SRC slave/containerizer/mesos/linux_launcher.cpp slave/containerizer/mesos/isolators/appc/runtime.cpp slave/containerizer/mesos/isolators/cgroups/cgroups.cpp - slave/containerizer/mesos/isolators/cgroups/devices.cpp slave/containerizer/mesos/isolators/cgroups/mem.cpp slave/containerizer/mesos/isolators/cgroups/net_cls.cpp slave/containerizer/mesos/isolators/cgroups/perf_event.cpp http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd3690b/src/Makefile.am -- diff --git a/src/Makefile.am b/src/Makefile.am index 2ef8a21..3c3f9bd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1025,7 +1025,6 @@ MESOS_LINUX_FILES = \ slave/containerizer/mesos/linux_launcher.cpp \ slave/containerizer/mesos/isolators/appc/runtime.cpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.cpp \ - slave/containerizer/mesos/isolators/cgroups/devices.cpp \ slave/containerizer/mesos/isolators/cgroups/mem.cpp \ slave/containerizer/mesos/isolators/cgroups/net_cls.cpp \ slave/containerizer/mesos/isolators/cgroups/perf_event.cpp \ @@ -1065,7 +1064,6 @@ MESOS_LINUX_FILES += \ slave/containerizer/mesos/isolators/appc/runtime.hpp \ slave/containerizer/mesos/isolators/cgroups/cgroups.hpp \ slave/containerizer/mesos/isolators/cgroups/constants.hpp \ - slave/containerizer/mesos/isolators/cgroups/devices.hpp \ slave/containerizer/mesos/isolators/cgroups/mem.hpp \ slave/containerizer/mesos/isolators/cgroups/net_cls.hpp \ slave/containerizer/mesos/isolators/cgroups/perf_event.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd3690b/src/slave/containerizer/mesos/containerizer.cpp -- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 0b240d4..c94a683 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -73,7 +73,6 @@ #ifdef __linux__ #include "slave/containerizer/mesos/isolators/cgroups/cgroups.hpp" -#include "slave/containerizer/mesos/isolators/cgroups/devices.hpp" #include "slave/containerizer/mesos/isolators/cgroups/mem.hpp" #include "slave/containerizer/mesos/isolators/cgroups/net_cls.hpp" #include "slave/containerizer/mesos/isolators/cgroups/perf_event.hpp" http://git-wip-us.apache.org/repos/asf/mesos/blob/dfd3690b/src/slave/containerizer/mesos/isolators/cgroups/devices.cpp -- diff --git a/src/slave/containerizer/mesos/isolators/cgroups/devices.cpp b/src/slave/containerizer/mesos/isolators/cgroups/devices.cpp deleted file mode 100644 index f1b5e75..000 --- a/src/slave/containerizer/mesos/isolators/cgroups/devices.cpp +++ /dev/null @@ -1,368 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -//
[16/17] mesos git commit: Refactored the test cases for perf_event cgroups isolation.
Refactored the test cases for perf_event cgroups isolation. Review: https://reviews.apache.org/r/51790/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/08594c26 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/08594c26 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/08594c26 Branch: refs/heads/master Commit: 08594c26a41fc9593ab69b62bd2f2cc8b177bbdc Parents: 665d4cc Author: haosdent huangAuthored: Mon Sep 12 16:35:14 2016 -0700 Committer: Jie Yu Committed: Tue Sep 13 10:52:01 2016 -0700 -- .../containerizer/cgroups_isolator_tests.cpp| 111 +++ 1 file changed, 111 insertions(+) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/08594c26/src/tests/containerizer/cgroups_isolator_tests.cpp -- diff --git a/src/tests/containerizer/cgroups_isolator_tests.cpp b/src/tests/containerizer/cgroups_isolator_tests.cpp index 4882af0..31c95c8 100644 --- a/src/tests/containerizer/cgroups_isolator_tests.cpp +++ b/src/tests/containerizer/cgroups_isolator_tests.cpp @@ -837,6 +837,117 @@ TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_NET_CLS_ContainerStatus) driver.join(); } + +TEST_F(CgroupsIsolatorTest, ROOT_CGROUPS_PERF_Sample) +{ + Try master = StartMaster(); + ASSERT_SOME(master); + + slave::Flags flags = CreateSlaveFlags(); + flags.perf_events = "cycles,task-clock"; + flags.perf_duration = Milliseconds(250); + flags.perf_interval = Milliseconds(500); + flags.isolation = "cgroups/perf_event"; + + Fetcher fetcher; + + Try _containerizer = +MesosContainerizer::create(flags, true, ); + + ASSERT_SOME(_containerizer); + + Owned containerizer(_containerizer.get()); + + Owned detector = master.get()->createDetector(); + + Try slave = StartSlave( + detector.get(), + containerizer.get()); + + ASSERT_SOME(slave); + + MockScheduler sched; + + MesosSchedulerDriver driver( + , + DEFAULT_FRAMEWORK_INFO, + master.get()->pid, + DEFAULT_CREDENTIAL); + + EXPECT_CALL(sched, registered(, _, _)) +.Times(1); + + Future offers; + EXPECT_CALL(sched, resourceOffers(, _)) +.WillOnce(FutureArg<1>()) +.WillRepeatedly(Return()); // Ignore subsequent offers. + + driver.start(); + + AWAIT_READY(offers); + EXPECT_NE(0u, offers.get().size()); + + TaskInfo task = createTask(offers.get()[0], "sleep 120"); + + Future statusRunning; + EXPECT_CALL(sched, statusUpdate(, _)) +.WillOnce(FutureArg<1>()); + + driver.launchTasks(offers.get()[0].id(), {task}); + + AWAIT_READY(statusRunning); + EXPECT_EQ(TASK_RUNNING, statusRunning.get().state()); + + Future containers = containerizer->containers(); + AWAIT_READY(containers); + EXPECT_EQ(1u, containers.get().size()); + + ContainerID containerId = *(containers.get().begin()); + + // This first sample is likely to be empty because perf hasn't + // completed yet but we should still have the required fields. + Future statistics1 = containerizer->usage(containerId); + AWAIT_READY(statistics1); + ASSERT_TRUE(statistics1.get().has_perf()); + EXPECT_TRUE(statistics1.get().perf().has_timestamp()); + EXPECT_TRUE(statistics1.get().perf().has_duration()); + + // Wait until we get the next sample. We use a generous timeout of + // two seconds because we currently have a one second reap interval; + // when running perf with perf_duration of 250ms we won't notice the + // exit for up to one second. + ResourceStatistics statistics2; + Duration waited = Duration::zero(); + do { +Future statistics = containerizer->usage(containerId); +AWAIT_READY(statistics); + +statistics2 = statistics.get(); + +ASSERT_TRUE(statistics2.has_perf()); + +if (statistics1.get().perf().timestamp() != +statistics2.perf().timestamp()) { + break; +} + +os::sleep(Milliseconds(250)); +waited += Milliseconds(250); + } while (waited < Seconds(2)); + + EXPECT_NE(statistics1.get().perf().timestamp(), +statistics2.perf().timestamp()); + + EXPECT_TRUE(statistics2.perf().has_cycles()); + EXPECT_LE(0u, statistics2.perf().cycles()); + + EXPECT_TRUE(statistics2.perf().has_task_clock()); + EXPECT_LE(0.0, statistics2.perf().task_clock()); + + driver.stop(); + driver.join(); +} + } // namespace tests { } // namespace internal { } // namespace mesos {
mesos git commit: Fixed an incorrect use of ASSERT_EQ.
Repository: mesos Updated Branches: refs/heads/master fbaeb5f37 -> f833169b4 Fixed an incorrect use of ASSERT_EQ. This assertion calls ASSERT_EQ(expect, actual) as if it was ASSERT_EQ(actual, expect). This matters because otherwise when the assertion fails it prints confusing output. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f833169b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f833169b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f833169b Branch: refs/heads/master Commit: f833169b479a2715e78199bb399597499adf54d4 Parents: fbaeb5f Author: Jiang Yan XuAuthored: Sun Sep 4 01:14:55 2016 -0700 Committer: Jiang Yan Xu Committed: Tue Sep 13 09:57:07 2016 -0700 -- src/tests/hierarchical_allocator_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/f833169b/src/tests/hierarchical_allocator_tests.cpp -- diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp index a2c0360..7705de9 100644 --- a/src/tests/hierarchical_allocator_tests.cpp +++ b/src/tests/hierarchical_allocator_tests.cpp @@ -3268,7 +3268,7 @@ TEST_F(HierarchicalAllocatorTest, UpdateWeight) // role2 share = 0 // framework2 share = 0 - ASSERT_EQ(allocation.get().frameworkId, framework1.id()); + ASSERT_EQ(framework1.id(), allocation.get().frameworkId); ASSERT_EQ(6u, allocation.get().resources.size()); EXPECT_EQ(Resources::parse(TOTAL_RESOURCES).get(), Resources::sum(allocation.get().resources));
mesos git commit: Checked correct file descriptor after call to `dup`.
Repository: mesos Updated Branches: refs/heads/master bda1194e7 -> fbaeb5f37 Checked correct file descriptor after call to `dup`. Review: https://reviews.apache.org/r/51839/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fbaeb5f3 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fbaeb5f3 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fbaeb5f3 Branch: refs/heads/master Commit: fbaeb5f37fc88dc51b8d51343e5f9fa8b8c60fa8 Parents: bda1194 Author: Benjamin BannierAuthored: Tue Sep 13 11:43:19 2016 +0200 Committer: Joris Van Remoortere Committed: Tue Sep 13 11:43:46 2016 +0200 -- 3rdparty/libprocess/src/libevent_ssl_socket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/fbaeb5f3/3rdparty/libprocess/src/libevent_ssl_socket.cpp -- diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp b/3rdparty/libprocess/src/libevent_ssl_socket.cpp index a26ff80..21f878e 100644 --- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp +++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp @@ -758,7 +758,7 @@ Future LibeventSSLSocketImpl::sendfile( // we may use `evbuffer_file_segment_new` and `evbuffer_add_file_segment` // instead of `evbuffer_add_file`. int owned_fd = dup(fd); - if (fd == -1) { + if (owned_fd < 0) { return Failure(ErrnoError("Failed to duplicate file descriptor")); }
mesos git commit: Removed dependency on external Docker image for mesos-tidy.
Repository: mesos Updated Branches: refs/heads/master 170c01f1a -> bda1194e7 Removed dependency on external Docker image for mesos-tidy. In order minimize external dependency, this patch modifies the implementation of `support/mesos-tidy.sh` to build the mesos-tidy Docker container on the fly just before executing tests. We follow the same basic idea already employed in `support/docker_build.sh` where the image is built, executed, and removed. Note that this approach likely does not take full advantage of Docker's caching capabilities. Review: https://reviews.apache.org/r/51650/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bda1194e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bda1194e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bda1194e Branch: refs/heads/master Commit: bda1194e7b5b2c6f145d1f4b4bc22c5132bfca1d Parents: 170c01f Author: Benjamin BannierAuthored: Tue Sep 13 11:01:28 2016 +0200 Committer: Michael Park Committed: Tue Sep 13 11:01:28 2016 +0200 -- support/mesos-tidy.sh | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/mesos/blob/bda1194e/support/mesos-tidy.sh -- diff --git a/support/mesos-tidy.sh b/support/mesos-tidy.sh index 36e7f03..da7d7ee 100755 --- a/support/mesos-tidy.sh +++ b/support/mesos-tidy.sh @@ -16,6 +16,13 @@ # See the License for the specific language governing permissions and # limitations under the License. + +# Prepare clang-tidy docker image. +TAG=mesos-tidy-`date +%s`-$RANDOM +# TODO(vinod): Instead of building Docker images on the fly host the +# images on DockerHub and use them. +docker build --no-cache=true -t $TAG mesos-tidy/ + # Configure how checks are run. These variables can be overriden by setting the # respective environment variables before invoking this script. # TODO(bbannier): Enable more upstream checks by default, e.g., from the Google set. @@ -39,4 +46,7 @@ docker run \ -v "${MESOS_DIRECTORY}":/SRC \ -e CHECKS="${CHECKS}" \ -e CONFIGURE_FLAGS="${CONFIGURE_FLAGS}" \ - mesosphere/mesos-tidy || exit 1 + $TAG || exit 1 + +# Set a trap to delete the image on exit. +trap "docker rmi $TAG" EXIT