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/11/12 02:57:23 UTC
[02/11] mesos git commit: Removed unnecessary 'parentHooks' parameter
from 'Launcher::fork()'.
Removed unnecessary 'parentHooks' parameter from 'Launcher::fork()'.
Review: https://reviews.apache.org/r/53350/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0f3eabcf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0f3eabcf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0f3eabcf
Branch: refs/heads/master
Commit: 0f3eabcfaed5e449988c239d312f17d3b25a04ca
Parents: b15b46a
Author: Kevin Klues <kl...@gmail.com>
Authored: Fri Nov 11 16:14:35 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Nov 11 16:14:35 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/mesos/launcher.cpp | 5 +++--
src/slave/containerizer/mesos/launcher.hpp | 6 ++----
src/slave/containerizer/mesos/linux_launcher.cpp | 14 ++++++--------
src/slave/containerizer/mesos/linux_launcher.hpp | 3 +--
src/tests/containerizer/launcher.cpp | 6 +++---
src/tests/containerizer/launcher.hpp | 5 ++---
6 files changed, 17 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/slave/containerizer/mesos/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.cpp b/src/slave/containerizer/mesos/launcher.cpp
index b45313f..bc33f19 100644
--- a/src/slave/containerizer/mesos/launcher.cpp
+++ b/src/slave/containerizer/mesos/launcher.cpp
@@ -87,8 +87,7 @@ Try<pid_t> PosixLauncher::fork(
const Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<map<string, string>>& environment,
- const Option<int>& namespaces,
- vector<process::Subprocess::ParentHook> parentHooks)
+ const Option<int>& namespaces)
{
if (namespaces.isSome() && namespaces.get() != 0) {
return Error("Posix launcher does not support namespaces");
@@ -101,6 +100,8 @@ Try<pid_t> PosixLauncher::fork(
// If we are on systemd, then extend the life of the child. Any
// grandchildren's lives will also be extended.
+ vector<process::Subprocess::ParentHook> parentHooks;
+
#ifdef __linux__
if (systemd::enabled()) {
parentHooks.emplace_back(Subprocess::ParentHook(
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/slave/containerizer/mesos/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.hpp b/src/slave/containerizer/mesos/launcher.hpp
index 6ceb02d..c1a390a 100644
--- a/src/slave/containerizer/mesos/launcher.hpp
+++ b/src/slave/containerizer/mesos/launcher.hpp
@@ -69,8 +69,7 @@ public:
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<int>& namespaces,
- std::vector<process::Subprocess::ParentHook> parentHooks = {}) = 0;
+ const Option<int>& namespaces) = 0;
// Kill all processes in the containerized context.
virtual process::Future<Nothing> destroy(const ContainerID& containerId) = 0;
@@ -105,8 +104,7 @@ public:
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<int>& namespaces,
- std::vector<process::Subprocess::ParentHook> parentHooks = {});
+ const Option<int>& namespaces);
virtual process::Future<Nothing> destroy(const ContainerID& containerId);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/slave/containerizer/mesos/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.cpp b/src/slave/containerizer/mesos/linux_launcher.cpp
index 0305d14..e96090f 100644
--- a/src/slave/containerizer/mesos/linux_launcher.cpp
+++ b/src/slave/containerizer/mesos/linux_launcher.cpp
@@ -79,8 +79,7 @@ public:
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<int>& namespaces,
- std::vector<process::Subprocess::ParentHook> parentHooks);
+ const Option<int>& namespaces);
virtual process::Future<Nothing> destroy(const ContainerID& containerId);
@@ -211,8 +210,7 @@ Try<pid_t> LinuxLauncher::fork(
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<map<string, string>>& environment,
- const Option<int>& namespaces,
- vector<Subprocess::ParentHook> parentHooks)
+ const Option<int>& namespaces)
{
return dispatch(
process.get(),
@@ -225,8 +223,7 @@ Try<pid_t> LinuxLauncher::fork(
err,
flags,
environment,
- namespaces,
- parentHooks).get();
+ namespaces).get();
}
@@ -388,8 +385,7 @@ Try<pid_t> LinuxLauncherProcess::fork(
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<map<string, string>>& environment,
- const Option<int>& namespaces,
- vector<Subprocess::ParentHook> parentHooks)
+ const Option<int>& namespaces)
{
// Make sure this container (nested or not) is unique.
if (containers.contains(containerId)) {
@@ -434,6 +430,8 @@ Try<pid_t> LinuxLauncherProcess::fork(
// Hook to extend the life of the child (and all of its
// descendants) using a systemd slice.
+ vector<Subprocess::ParentHook> parentHooks;
+
if (systemdHierarchy.isSome()) {
parentHooks.emplace_back(Subprocess::ParentHook([](pid_t child) {
return systemd::mesos::extendLifetime(child);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/slave/containerizer/mesos/linux_launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.hpp b/src/slave/containerizer/mesos/linux_launcher.hpp
index d235305..356d4de 100644
--- a/src/slave/containerizer/mesos/linux_launcher.hpp
+++ b/src/slave/containerizer/mesos/linux_launcher.hpp
@@ -51,8 +51,7 @@ public:
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<int>& namespaces,
- std::vector<process::Subprocess::ParentHook> parentHooks);
+ const Option<int>& namespaces);
virtual process::Future<Nothing> destroy(const ContainerID& containerId);
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/tests/containerizer/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launcher.cpp b/src/tests/containerizer/launcher.cpp
index a92d989..51ae4f9 100644
--- a/src/tests/containerizer/launcher.cpp
+++ b/src/tests/containerizer/launcher.cpp
@@ -30,7 +30,7 @@ ACTION_P(InvokeRecover, launcher)
ACTION_P(InvokeFork, launcher)
{
return launcher->real->fork(
- arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
@@ -51,9 +51,9 @@ TestLauncher::TestLauncher(const process::Owned<slave::Launcher>& _real)
EXPECT_CALL(*this, recover(_))
.WillRepeatedly(DoDefault());
- ON_CALL(*this, fork(_, _, _, _, _, _, _, _, _, _))
+ ON_CALL(*this, fork(_, _, _, _, _, _, _, _, _))
.WillByDefault(InvokeFork(this));
- EXPECT_CALL(*this, fork(_, _, _, _, _, _, _, _, _, _))
+ EXPECT_CALL(*this, fork(_, _, _, _, _, _, _, _, _))
.WillRepeatedly(DoDefault());
ON_CALL(*this, destroy(_))
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f3eabcf/src/tests/containerizer/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launcher.hpp b/src/tests/containerizer/launcher.hpp
index 773b458..5dcc391 100644
--- a/src/tests/containerizer/launcher.hpp
+++ b/src/tests/containerizer/launcher.hpp
@@ -56,7 +56,7 @@ public:
process::Future<hashset<ContainerID>>(
const std::list<mesos::slave::ContainerState>& states));
- MOCK_METHOD10(
+ MOCK_METHOD9(
fork,
Try<pid_t>(
const ContainerID& containerId,
@@ -67,8 +67,7 @@ public:
const process::Subprocess::IO& err,
const flags::FlagsBase* flags,
const Option<std::map<std::string, std::string>>& env,
- const Option<int>& namespaces,
- std::vector<process::Subprocess::ParentHook> parentHooks));
+ const Option<int>& namespaces));
MOCK_METHOD1(
destroy,