You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/04/25 01:37:31 UTC

git commit: Introducing ContainerInfo as part of CommandInfo

Repository: mesos
Updated Branches:
  refs/heads/master e97a11b36 -> f31e6097e


Introducing ContainerInfo as part of CommandInfo

Introduces the ContainerInfo protobuf as part of CommandInfo. Right
now, if present, the mesos containerizer fails the task launch to
point out that we do not support it on that containerizer.

This will be needed for the ExternalContainerizer and possibly other
containerizers as well.

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


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

Branch: refs/heads/master
Commit: f31e6097e0fabb76db34662b910f5dfef7b792ce
Parents: e97a11b
Author: Till Toenshoff <to...@me.com>
Authored: Thu Apr 24 16:13:15 2014 -0700
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Thu Apr 24 16:13:15 2014 -0700

----------------------------------------------------------------------
 include/mesos/mesos.proto                       | 21 ++++++++++++++++++++
 src/slave/containerizer/mesos_containerizer.cpp | 11 ++++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f31e6097/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 37f8a7f..d7fe068 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -137,9 +137,30 @@ message CommandInfo {
     optional bool executable = 2;
   }
 
+  // Describes a container.
+  // Not all containerizers currently implement ContainerInfo, so it
+  // is possible that a launched task will fail due to supplying this
+  // attribute.
+  // NOTE: The containerizer API is currently in an early beta or
+  // even alpha state. Some details, like the exact semantics of an
+  // "image" or "options" are not yet hardened.
+  // TODO(tillt): Describe the exact scheme and semantics of "image"
+  // and "options".
+  message ContainerInfo {
+    // URI describing the container image name.
+    required string image = 1;
+
+    // Describes additional options passed to the containerizer.
+    repeated string options = 2;
+  }
+
   repeated URI uris = 1;
   optional Environment environment = 2;
   required string value = 3;
+
+  // NOTE: MesosContainerizer does currently not support this attribute
+  // and tasks supplying a 'container' will fail.
+  optional ContainerInfo container = 4;
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/f31e6097/src/slave/containerizer/mesos_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos_containerizer.cpp b/src/slave/containerizer/mesos_containerizer.cpp
index 722f3fe..f5df979 100644
--- a/src/slave/containerizer/mesos_containerizer.cpp
+++ b/src/slave/containerizer/mesos_containerizer.cpp
@@ -403,6 +403,17 @@ Future<Nothing> MesosContainerizerProcess::launch(
     return Failure("Container already started");
   }
 
+  // TODO(tillt): The slave should expose which containerization
+  // mechanisms it supports to avoid scheduling tasks that it cannot
+  // run.
+  const CommandInfo& command = executorInfo.command();
+  if (command.has_container()) {
+    // We return a Failure as this containerizer does not support
+    // handling ContainerInfo. Users have to be made aware of this
+    // lack of support to prevent confusion in the task configuration.
+    return Failure("ContainerInfo is not supported");
+  }
+
   Owned<Promise<containerizer::Termination> > promise(
       new Promise<containerizer::Termination>());
   promises.put(containerId, promise);