You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by tn...@apache.org on 2014/10/29 00:56:17 UTC

[5/8] git commit: Support lxc configurations in docker containerizer

Support lxc configurations in docker containerizer


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

Branch: refs/heads/docker_symlink
Commit: 75046648a7613b34e99697ddbd4b18bc6532f795
Parents: 45699c7
Author: Timothy Chen <tn...@gmail.com>
Authored: Mon Sep 22 15:04:00 2014 -0700
Committer: Timothy Chen <tn...@gmail.com>
Committed: Tue Oct 28 23:02:38 2014 +0000

----------------------------------------------------------------------
 include/mesos/mesos.proto |  4 ++++
 src/docker/docker.cpp     | 12 ++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/75046648/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 1d4f673..07dc8fe 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -869,6 +869,7 @@ message ContainerInfo {
     enum Network {
       HOST = 1;
       BRIDGE = 2;
+      NONE = 3;
     }
 
     optional Network network = 2 [default = HOST];
@@ -883,6 +884,9 @@ message ContainerInfo {
     repeated PortMapping port_mappings = 3;
 
     optional bool privileged = 4 [default = false];
+
+    // lxc specific configuration.
+    repeated Parameter lxc_configs = 5;
   }
 
   required Type type = 1;

http://git-wip-us.apache.org/repos/asf/mesos/blob/75046648/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 81d538a..a9dacd4 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -361,12 +361,24 @@ Future<Nothing> Docker::run(
   switch (dockerInfo.network()) {
     case ContainerInfo::DockerInfo::HOST: network = "host"; break;
     case ContainerInfo::DockerInfo::BRIDGE: network = "bridge"; break;
+    case ContainerInfo::DockerInfo::NONE: network = "none"; break;
     default: return Failure("Unsupported Network mode: " +
                             stringify(dockerInfo.network()));
   }
 
   argv.push_back(network);
 
+  if (dockerInfo.lxc_configs().size() > 0) {
+    if (network != "none") {
+      return Failure("Network mode has to be 'NONE' to support lxc configs");
+    }
+
+    foreach (const Parameter& param, dockerInfo.lxc_configs()) {
+      argv.push_back("--lxc-conf");
+      argv.push_back(param.key() + "=" + param.value());
+    }
+  }
+
   if (dockerInfo.port_mappings().size() > 0) {
     if (network != "bridge") {
       return Failure("Port mappings are only supported for bridge network");