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 2017/08/24 04:16:01 UTC

[1/2] mesos git commit: Adjusted the ContainerLaunchInfo.command merge logic.

Repository: mesos
Updated Branches:
  refs/heads/1.4.x 4a01fc2f1 -> 68991715a


Adjusted the ContainerLaunchInfo.command merge logic.

This patches addressed MESOS-7909 by eliminating the ordering
dependency between the `linux/capabilities` isolator and the
`docker/runtime` or `appc/runtime` isolator.

Now, for command tasks, we always merge with the command executor
command in MesosContainerizer. Previously, this is done in the
`docker/runtime` or `appc/runtime` isolator, which introduced this
unintentional dependency on the isolator ordering.

Review: https://reviews.apache.org/r/61869


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2c3f5152
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2c3f5152
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2c3f5152

Branch: refs/heads/1.4.x
Commit: 2c3f51522bbae07345f3eb8b2856981930321df0
Parents: 4a01fc2
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 23 15:55:13 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 23 21:11:31 2017 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 24 ++++++++++++++++++++
 .../mesos/isolators/appc/runtime.cpp            | 11 +++------
 .../mesos/isolators/docker/runtime.cpp          | 11 +++------
 3 files changed, 30 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2c3f5152/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 5772421..417507f 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1375,6 +1375,30 @@ Future<bool> MesosContainerizerProcess::_launch(
   // Determine the launch command for the container.
   if (!launchInfo.has_command()) {
     launchInfo.mutable_command()->CopyFrom(container->config.command_info());
+  } else {
+    // For command tasks, merge the launch commands with the executor
+    // launch command.
+    if (container->config.has_task_info()) {
+      // Isolators are not supposed to set any other fields in the
+      // command except the arguments for the command executor.
+      CHECK(launchInfo.command().uris().empty())
+        << "Isolators mutate 'uris' in container launch command";
+      CHECK(!launchInfo.command().has_environment())
+        << "Isolators mutate 'environment' in container launch command";
+      CHECK(!launchInfo.command().has_shell())
+        << "Isolators mutate 'shell' in container launch command";
+      CHECK(!launchInfo.command().has_value())
+        << "Isolators mutate 'value' in container launch command";
+      CHECK(!launchInfo.command().has_user())
+        << "Isolators mutate 'user' in container launch command";
+
+      // NOTE: The ordering here is important because we want the
+      // command executor arguments to be in front of the arguments
+      // set by isolators. See details in MESOS-7909.
+      CommandInfo launchCommand = container->config.command_info();
+      launchCommand.MergeFrom(launchInfo.command());
+      launchInfo.mutable_command()->CopyFrom(launchCommand);
+    }
   }
 
   // For command tasks specifically, we should add the task_environment

http://git-wip-us.apache.org/repos/asf/mesos/blob/2c3f5152/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/appc/runtime.cpp b/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
index f76b22b..535ea1a 100644
--- a/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
+++ b/src/slave/containerizer/mesos/isolators/appc/runtime.cpp
@@ -111,29 +111,24 @@ Future<Option<ContainerLaunchInfo>> AppcRuntimeIsolatorProcess::prepare(
   // be included in 'ContainerLaunchInfo', and will be passed back
   // to containerizer.
   if (containerConfig.has_task_info()) {
-    // Command task case. The 'executorCommand' below is the
-    // command with value as 'mesos-executor'.
-    CommandInfo executorCommand = containerConfig.executor_info().command();
-
+    // Command task case.
     if (environment.isSome()) {
       launchInfo.mutable_task_environment()->CopyFrom(environment.get());
     }
 
     // Pass working directory to command executor as a flag.
     if (workingDirectory.isSome()) {
-      executorCommand.add_arguments(
+      launchInfo.mutable_command()->add_arguments(
           "--working_directory=" + workingDirectory.get());
     }
 
     // Pass task command as a flag, which will be loaded by
     // command executor.
     if (command.isSome()) {
-      executorCommand.add_arguments(
+      launchInfo.mutable_command()->add_arguments(
           "--task_command=" +
           stringify(JSON::protobuf(command.get())));
     }
-
-    launchInfo.mutable_command()->CopyFrom(executorCommand);
   } else {
     // The custom executor, default executor and nested container cases.
     if (environment.isSome()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/2c3f5152/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
index 2a6e0b1..93394f8 100644
--- a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
+++ b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
@@ -131,29 +131,24 @@ Future<Option<ContainerLaunchInfo>> DockerRuntimeIsolatorProcess::prepare(
   // be included in 'ContainerLaunchInfo', and will be passed
   // back to containerizer.
   if (containerConfig.has_task_info()) {
-    // Command task case. The 'executorCommand' below is the
-    // command with value as 'mesos-executor'.
-    CommandInfo executorCommand = containerConfig.executor_info().command();
-
+    // Command task case.
     if (environment.isSome()) {
       launchInfo.mutable_task_environment()->CopyFrom(environment.get());
     }
 
     // Pass working directory to command executor as a flag.
     if (workingDirectory.isSome()) {
-      executorCommand.add_arguments(
+      launchInfo.mutable_command()->add_arguments(
           "--working_directory=" + workingDirectory.get());
     }
 
     // Pass task command as a flag, which will be loaded by
     // command executor.
     if (command.isSome()) {
-      executorCommand.add_arguments(
+      launchInfo.mutable_command()->add_arguments(
           "--task_command=" +
           stringify(JSON::protobuf(command.get())));
     }
-
-    launchInfo.mutable_command()->CopyFrom(executorCommand);
   } else {
     // The custom executor, default executor and nested container cases.
     if (environment.isSome()) {


[2/2] mesos git commit: Added MESOS-7909 to 1.4.1 CHANGELOG.

Posted by ji...@apache.org.
Added MESOS-7909 to 1.4.1 CHANGELOG.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/68991715
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/68991715
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/68991715

Branch: refs/heads/1.4.x
Commit: 68991715abc91826836212d43e1299a9df0c37c4
Parents: 2c3f515
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 23 21:14:55 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Aug 23 21:15:51 2017 -0700

----------------------------------------------------------------------
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/68991715/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index cd6d3d6..daf6125 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ All Issues:
 ** Bug
   * [MESOS-7863] - Agent may drop pending kill task status updates.
   * [MESOS-7865] - Agent may process a kill task and still launch the task.
+  * [MESOS-7909] - Ordering dependency between 'linux/capabilities' and 'docker/runtime' isolator.
 
 
 Release Notes - Mesos - Version 1.4.0