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/02/11 02:38:03 UTC

[1/6] mesos git commit: Fixed local puller switch condition to support docker registry.

Repository: mesos
Updated Branches:
  refs/heads/master f2a71af11 -> e84405800


Fixed local puller switch condition to support docker registry.

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


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

Branch: refs/heads/master
Commit: 7de26f6a7d73bcee2a18bb588f59900c1732c71d
Parents: f2a71af
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:22 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:22 2016 -0800

----------------------------------------------------------------------
 docs/configuration.md                                   |  2 +-
 .../mesos/provisioner/docker/local_puller.cpp           | 12 ++++--------
 .../containerizer/mesos/provisioner/docker/puller.cpp   |  2 +-
 src/slave/flags.cpp                                     |  2 +-
 src/tests/containerizer/provisioner_docker_tests.cpp    |  4 ++--
 5 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7de26f6a/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index b26a058..eea985c 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1103,7 +1103,7 @@ Timeout in seconds for pulling images from the Docker registry (default: 60secs)
   <td>
 The default url for pulling Docker images. It could either be a Docker
 registry server url (i.e: <code>https://registry.docker.io</code>), or a local
-path (i.e: <code>file:///tmp/docker/images</code>) in which Docker image archives
+path (i.e: <code>/tmp/docker/images</code>) in which Docker image archives
 (result of <code>docker save</code>) are stored. (default: https://registry-1.docker.io)
   </td>
 </tr>

http://git-wip-us.apache.org/repos/asf/mesos/blob/7de26f6a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp b/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
index 6ae920a..abf6ddf 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/local_puller.cpp
@@ -76,16 +76,12 @@ private:
 Try<Owned<Puller>> LocalPuller::create(const Flags& flags)
 {
   // This should already been verified at puller.cpp.
-  if (!strings::startsWith(flags.docker_registry, "file://")) {
-    return Error("Expecting registry url to have file:// scheme");
+  if (!strings::startsWith(flags.docker_registry, "/")) {
+    return Error("Expecting registry url starting with '/'");
   }
 
-  const string archivesDir = strings::remove(
-      flags.docker_registry,
-      "file://",
-      strings::Mode::PREFIX);
-
-  Owned<LocalPullerProcess> process(new LocalPullerProcess(archivesDir));
+  Owned<LocalPullerProcess> process(
+      new LocalPullerProcess(flags.docker_registry));
 
   return Owned<Puller>(new LocalPuller(process));
 }

http://git-wip-us.apache.org/repos/asf/mesos/blob/7de26f6a/src/slave/containerizer/mesos/provisioner/docker/puller.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/docker/puller.cpp b/src/slave/containerizer/mesos/provisioner/docker/puller.cpp
index 5650f2f..a239b97 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/puller.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/puller.cpp
@@ -51,7 +51,7 @@ namespace docker {
 Try<Owned<Puller>> Puller::create(const Flags& flags)
 {
   // TODO(tnachen): Support multiple registries in the puller.
-  if (strings::startsWith(flags.docker_registry, "file://")) {
+  if (strings::startsWith(flags.docker_registry, "/")) {
     Try<Owned<Puller>> puller = LocalPuller::create(flags);
     if (puller.isError()) {
       return Error("Failed to create local puller: " + puller.error());

http://git-wip-us.apache.org/repos/asf/mesos/blob/7de26f6a/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 2ce7f92..14ad4dc 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -132,7 +132,7 @@ mesos::internal::slave::Flags::Flags()
       "docker_registry",
       "The default url for pulling Docker images. It could either be a Docker\n"
       "registry server url (i.e: `https://registry.docker.io`), or a local\n"
-      "path (i.e: `file:///tmp/docker/images`) in which Docker image archives\n"
+      "path (i.e: `/tmp/docker/images`) in which Docker image archives\n"
       "(result of `docker save`) are stored.",
       "https://registry-1.docker.io");
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/7de26f6a/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp b/src/tests/containerizer/provisioner_docker_tests.cpp
index 824f897..4f77dcb 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -1143,7 +1143,7 @@ TEST_F(ProvisionerDockerLocalStoreTest, LocalStoreTestWithTar)
   ASSERT_SOME(os::mkdir(image));
 
   slave::Flags flags;
-  flags.docker_registry = "file://" + archivesDir;
+  flags.docker_registry = archivesDir;
   flags.docker_store_dir = path::join(os::getcwd(), "store");
 
   Try<Owned<slave::Store>> store = slave::docker::Store::create(flags);
@@ -1165,7 +1165,7 @@ TEST_F(ProvisionerDockerLocalStoreTest, LocalStoreTestWithTar)
 TEST_F(ProvisionerDockerLocalStoreTest, MetadataManagerInitialization)
 {
   slave::Flags flags;
-  flags.docker_registry = "file://" + path::join(os::getcwd(), "images");
+  flags.docker_registry = path::join(os::getcwd(), "images");
   flags.docker_store_dir = path::join(os::getcwd(), "store");
 
   Try<Owned<slave::Store>> store = slave::docker::Store::create(flags);


[5/6] mesos git commit: Fixed adding executable as first argv in runtime isolator.

Posted by ji...@apache.org.
Fixed adding executable as first argv in runtime isolator.

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


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

Branch: refs/heads/master
Commit: 38df717db59b2da892c5abd451e3dd92453de31d
Parents: 0d74fb6
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:36 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:36 2016 -0800

----------------------------------------------------------------------
 src/slave/containerizer/mesos/isolators/docker/runtime.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/38df717d/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 71c287c..1bb5e28 100644
--- a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
+++ b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
@@ -300,6 +300,7 @@ Result<CommandInfo> DockerRuntimeIsolatorProcess::getExecutorLaunchCommand(
     // Put user defined argv after default entrypoint argv
     // in sequence.
     command.clear_arguments();
+    command.add_arguments(config.entrypoint(0));
 
     for (int i = 1; i < config.entrypoint_size(); i++) {
       command.add_arguments(config.entrypoint(i));
@@ -319,17 +320,18 @@ Result<CommandInfo> DockerRuntimeIsolatorProcess::getExecutorLaunchCommand(
     // Overwrite default cmd arguments if CommandInfo arguments are
     // set by user. The logic below is the case that no argument is
     // set by user.
-    if (command.arguments_size() == config.entrypoint_size() - 1) {
+    if (command.arguments_size() == config.entrypoint_size()) {
       foreach (const string& cmd, config.cmd()) {
         command.add_arguments(cmd);
       }
     }
   } else if (config.cmd_size() > 0) {
     command.set_value(config.cmd(0));
+    command.add_arguments(config.cmd(0));
 
     // Overwrite default cmd arguments if CommandInfo arguments
     // are set by user.
-    if (command.arguments_size() == 0) {
+    if (command.arguments_size() == 1) {
       for (int i = 1; i < config.cmd_size(); i++) {
         command.add_arguments(config.cmd(i));
       }


[6/6] mesos git commit: Prevented linux fs isolator mounting rootfs for command executor.

Posted by ji...@apache.org.
Prevented linux fs isolator mounting rootfs for command executor.

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


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

Branch: refs/heads/master
Commit: e84405800103866941215be7bfc486ddf0b56191
Parents: 38df717
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:40 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:40 2016 -0800

----------------------------------------------------------------------
 include/mesos/slave/isolator.proto                           | 3 +++
 src/slave/containerizer/mesos/isolators/filesystem/linux.cpp | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e8440580/include/mesos/slave/isolator.proto
----------------------------------------------------------------------
diff --git a/include/mesos/slave/isolator.proto b/include/mesos/slave/isolator.proto
index 5a44b68..60a9bb6 100644
--- a/include/mesos/slave/isolator.proto
+++ b/include/mesos/slave/isolator.proto
@@ -77,6 +77,9 @@ message ContainerConfig {
   // The user the task will be run as.
   optional string user = 4;
 
+  // NOTE: 'rootfs' and 'docker' below are for the executor in custom
+  // executor case, and they are for the task in command task case.
+
   // The root filesystem for the container.
   optional string rootfs = 5;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/e8440580/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
index b9615be..7fdf518 100644
--- a/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
+++ b/src/slave/containerizer/mesos/isolators/filesystem/linux.cpp
@@ -278,7 +278,7 @@ Future<Option<ContainerLaunchInfo>> LinuxFilesystemIsolatorProcess::prepare(
   ContainerLaunchInfo launchInfo;
   launchInfo.set_namespaces(CLONE_NEWNS);
 
-  if (containerConfig.has_rootfs()) {
+  if (!containerConfig.has_task_info() && containerConfig.has_rootfs()) {
     // If the container changes its root filesystem, we need to mount
     // the container's work directory into its root filesystem
     // (creating it if needed) so that the executor and the task can
@@ -462,7 +462,7 @@ Try<string> LinuxFilesystemIsolatorProcess::script(
     string target;
 
     if (strings::startsWith(volume.container_path(), "/")) {
-      if (containerConfig.has_rootfs()) {
+      if (!containerConfig.has_task_info() && containerConfig.has_rootfs()) {
         target = path::join(
             containerConfig.rootfs(),
             volume.container_path());
@@ -481,7 +481,7 @@ Try<string> LinuxFilesystemIsolatorProcess::script(
       // 'rootfs' because a user can potentially use a container path
       // like '/../../abc'.
     } else {
-      if (containerConfig.has_rootfs()) {
+      if (!containerConfig.has_task_info() && containerConfig.has_rootfs()) {
         target = path::join(containerConfig.rootfs(),
                             flags.sandbox_directory,
                             volume.container_path());


[3/6] mesos git commit: Added shell flag to mesos-execute to run image default config.

Posted by ji...@apache.org.
Added shell flag to mesos-execute to run image default config.

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


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

Branch: refs/heads/master
Commit: ab9aa58f1ae1a38124211e109c84bc0db4ad9864
Parents: aed3286
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:29 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:29 2016 -0800

----------------------------------------------------------------------
 src/cli/execute.cpp | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ab9aa58f/src/cli/execute.cpp
----------------------------------------------------------------------
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index 4b2244c..ed42cb5 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -65,6 +65,12 @@ public:
         "name",
         "Name for the command");
 
+    add(&shell,
+        "shell",
+        "Determine the command is a shell or not. If not, 'command' will be\n"
+        "treated as executable value and arguments (TODO).",
+        true);
+
     add(&command,
         "command",
         "Shell command to launch");
@@ -121,6 +127,7 @@ public:
 
   Option<string> master;
   Option<string> name;
+  bool shell;
   Option<string> command;
   Option<hashmap<string, string>> environment;
   string resources;
@@ -139,13 +146,15 @@ class CommandScheduler : public Scheduler
 public:
   CommandScheduler(
       const string& _name,
-      const string& _command,
+      const bool& _shell,
+      const Option<string>& _command,
       const Option<hashmap<string, string>>& _environment,
       const string& _resources,
       const Option<string>& _uri,
       const Option<string>& _dockerImage,
       const string& _containerizer)
     : name(_name),
+      shell(_shell),
       command(_command),
       environment(_environment),
       resources(_resources),
@@ -195,7 +204,17 @@ public:
         task.mutable_resources()->CopyFrom(TASK_RESOURCES.get());
 
         CommandInfo* commandInfo = task.mutable_command();
-        commandInfo->set_value(command);
+
+        if (shell) {
+          CHECK_SOME(command);
+
+          commandInfo->set_shell(true);
+          commandInfo->set_value(command.get());
+        } else {
+          // TODO(gilbert): Treat 'command' as executable value and arguments.
+          commandInfo->set_shell(false);
+        }
+
         if (environment.isSome()) {
           Environment* environment_ = commandInfo->mutable_environment();
           foreachpair (
@@ -295,7 +314,8 @@ public:
 
 private:
   const string name;
-  const string command;
+  bool shell;
+  const Option<string> command;
   const Option<hashmap<string, string>> environment;
   const string resources;
   const Option<string> uri;
@@ -343,7 +363,7 @@ int main(int argc, char** argv)
     return EXIT_FAILURE;
   }
 
-  if (flags.command.isNone()) {
+  if (flags.shell && flags.command.isNone()) {
     cerr << flags.usage("Missing required option --command") << endl;
     return EXIT_FAILURE;
   }
@@ -428,7 +448,8 @@ int main(int argc, char** argv)
 
   CommandScheduler scheduler(
       flags.name.get(),
-      flags.command.get(),
+      flags.shell,
+      flags.command,
       environment,
       flags.resources,
       uri,


[2/6] mesos git commit: Removed `Volumes` in docker v1 manifest protobuf.

Posted by ji...@apache.org.
Removed `Volumes` in docker v1 manifest protobuf.

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


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

Branch: refs/heads/master
Commit: aed328662e173a56c0ca5a7ccc5c0eef0f2ec081
Parents: 7de26f6
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:26 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:26 2016 -0800

----------------------------------------------------------------------
 include/mesos/docker/v1.proto | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/aed32866/include/mesos/docker/v1.proto
----------------------------------------------------------------------
diff --git a/include/mesos/docker/v1.proto b/include/mesos/docker/v1.proto
index fab3b08..ff18f8c 100644
--- a/include/mesos/docker/v1.proto
+++ b/include/mesos/docker/v1.proto
@@ -46,7 +46,6 @@ message ImageManifest {
     optional string User = 4;
     repeated string Cmd = 5;
     optional string WorkingDir = 6;
-    optional string Volumes = 7;
 
     // Name of the image as it was passed by the operator.
     optional string Image = 8;


[4/6] mesos git commit: Fixed owned pointer reset in containerizer launch.

Posted by ji...@apache.org.
Fixed owned pointer reset in containerizer launch.

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


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

Branch: refs/heads/master
Commit: 0d74fb6a60870367b7046170c6f0855a0053f955
Parents: ab9aa58
Author: Gilbert Song <so...@gmail.com>
Authored: Wed Feb 10 16:55:32 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Feb 10 16:55:32 2016 -0800

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0d74fb6a/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index b484630..3de214d 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -759,13 +759,13 @@ Future<bool> MesosContainerizerProcess::_launch(
     const Image& image = volume->image();
 
     futures.push_back(provisioner->provision(containerId, image)
-      .then([=](const ProvisionInfo& info) mutable -> Future<Nothing> {
+      .then([=](const ProvisionInfo& info) -> Future<Nothing> {
         volume->set_host_path(info.rootfs);
 
         if (taskInfo.isSome() &&
             volume->container_path() ==
               COMMAND_EXECUTOR_ROOTFS_CONTAINER_PATH) {
-          _provisionInfo.reset(new Option<ProvisionInfo>(info));
+          *_provisionInfo = info;
         }
 
         return Nothing();