You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2015/09/24 06:18:34 UTC
[3/4] mesos git commit: Assign executors to `mesos_executor.slice` in
LinuxLauncher on Systemd.
Assign executors to `mesos_executor.slice` in LinuxLauncher on Systemd.
Review: https://reviews.apache.org/r/38636
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3a088cc4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3a088cc4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3a088cc4
Branch: refs/heads/master
Commit: 3a088cc41ff98b4235466748a45966324eaeca48
Parents: 76a4e18
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Mon Sep 14 08:07:54 2015 -0400
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Wed Sep 23 20:56:53 2015 -0700
----------------------------------------------------------------------
src/slave/containerizer/linux_launcher.cpp | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/3a088cc4/src/slave/containerizer/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/linux_launcher.cpp b/src/slave/containerizer/linux_launcher.cpp
index b746e54..2b33d2d 100644
--- a/src/slave/containerizer/linux_launcher.cpp
+++ b/src/slave/containerizer/linux_launcher.cpp
@@ -356,6 +356,28 @@ Try<pid_t> LinuxLauncher::fork(
return Error("Failed to contain process");
}
+ // If we are on systemd, then move the child into the
+ // `SYSTEMD_MESOS_EXECUTORS_SLICE`. As with the freezer, any grandchildren
+ // will also be contained in the slice.
+ if (systemdHierarchy.isSome()) {
+ Try<Nothing> assign = cgroups::assign(
+ systemdHierarchy.get(),
+ SYSTEMD_MESOS_EXECUTORS_SLICE,
+ child.get().pid());
+
+ if (assign.isError()) {
+ LOG(ERROR) << "Failed to assign process " << child.get().pid()
+ << " of container '" << containerId << "'"
+ << " to its systemd executor slice: " << assign.error();
+
+ ::kill(child.get().pid(), SIGKILL);
+ return Error("Failed to contain process on systemd");
+ }
+
+ LOG(INFO) << "Assigned child process `" << child.get().pid() << "` to `"
+ << SYSTEMD_MESOS_EXECUTORS_SLICE << "`";
+ }
+
// Now that we've contained the child we can signal it to continue
// by writing to the pipe.
char dummy;