mesos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <jor...@gmail.com>
Subject Re: [3/3] mesos git commit: Plugged in docker runtime isolator.
Date Thu, 04 Feb 2016 04:54:01 GMT

> On Feb 3, 2016, at 5:45 PM, jieyu@apache.org wrote:
> 
> Plugged in docker runtime isolator.
> 
> Review: https://reviews.apache.org/r/43036/
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0b0a3dc5
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0b0a3dc5
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0b0a3dc5
> 
> Branch: refs/heads/master
> Commit: 0b0a3dc5467224511b1963dd0ac530bca7506376
> Parents: 2d5d14f
> Author: Gilbert Song <songzihao1990@gmail.com>
> Authored: Wed Feb 3 17:14:23 2016 -0800
> Committer: Jie Yu <yujie.jay@gmail.com>
> Committed: Wed Feb 3 17:14:23 2016 -0800
> 
> ----------------------------------------------------------------------
> src/slave/containerizer/mesos/containerizer.cpp | 12 +++++++-
> .../mesos/isolators/docker/runtime.cpp          | 30 ++++++++++++++++++--
> 2 files changed, 39 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/mesos/blob/0b0a3dc5/src/slave/containerizer/mesos/containerizer.cpp
> ----------------------------------------------------------------------
> diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
> index 5f8b6c7..12294cd 100644
> --- a/src/slave/containerizer/mesos/containerizer.cpp
> +++ b/src/slave/containerizer/mesos/containerizer.cpp
> @@ -63,6 +63,10 @@
> #endif
> 
> #ifdef __linux__
> +#include "slave/containerizer/mesos/isolators/docker/runtime.hpp"
> +#endif
> +
> +#ifdef __linux__
> #include "slave/containerizer/mesos/isolators/filesystem/linux.hpp"
> #endif
> #include "slave/containerizer/mesos/isolators/filesystem/posix.hpp"
> @@ -210,6 +214,7 @@ Try<MesosContainerizer*> MesosContainerizer::create(
>     {"cgroups/mem", &CgroupsMemIsolatorProcess::create},
>     {"cgroups/net_cls", &CgroupsNetClsIsolatorProcess::create},
>     {"cgroups/perf_event", &CgroupsPerfEventIsolatorProcess::create},
> +    {"docker/runtime", &DockerRuntimeIsolatorProcess::create},
>     {"namespaces/pid", &NamespacesPidIsolatorProcess::create},
> #endif
> #ifdef WITH_NETWORK_ISOLATOR
> @@ -839,7 +844,12 @@ Future<list<Option<ContainerLaunchInfo>>> MesosContainerizerProcess::prepare(
>   }
> 
>   if (provisionInfo.isSome()) {
> -    containerConfig.set_rootfs(provisionInfo.get().rootfs);
> +    containerConfig.set_rootfs(provisionInfo->rootfs);
> +
> +    if (provisionInfo->dockerManifest.isSome()) {
> +      ContainerConfig::Docker* docker = containerConfig.mutable_docker();
> +      docker->mutable_manifest()->CopyFrom(provisionInfo->dockerManifest.get());
> +    }
>   }
> 
>   // We prepare the isolators sequentially according to their ordering
> 
> http://git-wip-us.apache.org/repos/asf/mesos/blob/0b0a3dc5/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 f5f9678..5189a6d 100644
> --- a/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
> +++ b/src/slave/containerizer/mesos/isolators/docker/runtime.cpp
> @@ -16,6 +16,10 @@
> 
> #include <list>
> 
> +#include <glog/logging.h>
> +
> +#include <stout/stringify.hpp>
> +
> #include "slave/flags.hpp"
> 
> #include "slave/containerizer/mesos/isolators/docker/runtime.hpp"
> @@ -48,7 +52,10 @@ DockerRuntimeIsolatorProcess::~DockerRuntimeIsolatorProcess() {}
> 
> Try<Isolator*> DockerRuntimeIsolatorProcess::create(const Flags& flags)
> {
> -  return nullptr;
> +  process::Owned<MesosIsolatorProcess> process(
> +      new DockerRuntimeIsolatorProcess(flags));
> +
> +  return new MesosIsolator(process);
> }
> 
> 
> @@ -64,7 +71,26 @@ Future<Option<ContainerLaunchInfo>> DockerRuntimeIsolatorProcess::prepare(
>     const ContainerID& containerId,
>     const ContainerConfig& containerConfig)
> {
> -  return None();
> +  const ExecutorInfo& executorInfo = containerConfig.executor_info();
> +
> +  if (!executorInfo.has_container()) {
> +    return None();
> +  }
> +
> +  if (executorInfo.container().type() != ContainerInfo::MESOS) {
> +    return Failure("Can only prepare docker runtime for a MESOS contaienr");

s/contaienr/container/

> +  }
> +
> +  if (!containerConfig.has_docker()) {
> +    // No docker image default config available.
> +    return None();
> +  }
> +
> +  // Contains docker image default environment variables, merged
> +  // command, and working directory.
> +  ContainerLaunchInfo launchInfo;
> +
> +  return launchInfo;
> }
> 
> 
> 


Mime
View raw message