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/03/16 23:11:03 UTC

mesos git commit: Revert "Fix for docker containerizer not configuring CFS quotas correctly."

Repository: mesos
Updated Branches:
  refs/heads/master be9e86022 -> 9029e4347


Revert "Fix for docker containerizer not configuring CFS quotas correctly."

This reverts commit be9e86022ff86620800503c41d2fef0c6387aaba.


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

Branch: refs/heads/master
Commit: 9029e4347cd3619709f8f65fa3ee5e9b7c000bd5
Parents: be9e860
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Mar 16 15:10:54 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Mar 16 15:10:54 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 57 ++-------------------------------
 src/slave/containerizer/docker.hpp |  5 +--
 2 files changed, 4 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9029e434/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 76d24fc..fb9188a 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -694,8 +694,7 @@ Future<Nothing> DockerContainerizer::update(
       process.get(),
       &DockerContainerizerProcess::update,
       containerId,
-      resources,
-      false);
+      resources);
 }
 
 
@@ -1066,16 +1065,6 @@ Future<bool> DockerContainerizerProcess::launch(
       }))
       .then(defer(self(), [=]() { return launchExecutorProcess(containerId); }))
       .then(defer(self(), [=](pid_t pid) {
-        // Call update to set CPU/CFS/mem quotas at launch.
-        // TODO(steveniemitz): Once the minimum docker version supported
-        // is >= 1.7 this can be changed to pass --cpu-period and --cpu-quota
-        // to the 'docker run' call in launchExecutorProcess.
-        return update(containerId, executorInfo.resources(), true)
-          .then([=]() {
-            return Future<pid_t>(pid);
-          });
-      }))
-      .then(defer(self(), [=](pid_t pid) {
         return reapExecutor(containerId, pid);
       }));
   }
@@ -1103,16 +1092,6 @@ Future<bool> DockerContainerizerProcess::launch(
       return launchExecutorContainer(containerId, containerName);
     }))
     .then(defer(self(), [=](const Docker::Container& dockerContainer) {
-      // Call update to set CPU/CFS/mem quotas at launch.
-      // TODO(steveniemitz): Once the minimum docker version supported
-      // is >= 1.7 this can be changed to pass --cpu-period and --cpu-quota
-      // to the 'docker run' call in launchExecutorContainer.
-      return update(containerId, executorInfo.resources(), true)
-        .then([=]() {
-          return Future<Docker::Container>(dockerContainer);
-        });
-    }))
-    .then(defer(self(), [=](const Docker::Container& dockerContainer) {
       return checkpointExecutor(containerId, dockerContainer);
     }))
     .then(defer(self(), [=](pid_t pid) {
@@ -1317,8 +1296,7 @@ Future<bool> DockerContainerizerProcess::reapExecutor(
 
 Future<Nothing> DockerContainerizerProcess::update(
     const ContainerID& containerId,
-    const Resources& _resources,
-    bool force)
+    const Resources& _resources)
 {
   if (!containers_.contains(containerId)) {
     LOG(WARNING) << "Ignoring updating unknown container: "
@@ -1334,7 +1312,7 @@ Future<Nothing> DockerContainerizerProcess::update(
     return Nothing();
   }
 
-  if (container->resources == _resources && !force) {
+  if (container->resources == _resources) {
     LOG(INFO) << "Ignoring updating container '" << containerId
               << "' with resources passed to update is identical to "
               << "existing resources";
@@ -1449,35 +1427,6 @@ Future<Nothing> DockerContainerizerProcess::__update(
     LOG(INFO) << "Updated 'cpu.shares' to " << shares
               << " at " << path::join(cpuHierarchy.get(), cpuCgroup.get())
               << " for container " << containerId;
-
-    // Set cfs quota if enabled.
-    if (flags.cgroups_enable_cfs) {
-      write = cgroups::cpu::cfs_period_us(
-          cpuHierarchy.get(),
-          cpuCgroup.get(),
-          CPU_CFS_PERIOD);
-
-      if (write.isError()) {
-        return Failure("Failed to update 'cpu.cfs_period_us': " +
-                       write.error());
-      }
-
-      Duration quota = std::max(CPU_CFS_PERIOD * cpuShares, MIN_CPU_CFS_QUOTA);
-
-      write = cgroups::cpu::cfs_quota_us(
-          cpuHierarchy.get(),
-          cpuCgroup.get(),
-          quota);
-
-      if (write.isError()) {
-        return Failure("Failed to update 'cpu.cfs_quota_us': " + write.error());
-      }
-
-      LOG(INFO) << "Updated 'cpu.cfs_period_us' to " << CPU_CFS_PERIOD
-                << " and 'cpu.cfs_quota_us' to " << quota
-                << " (cpus " << cpuShares << ")"
-                << " for container " << containerId;
-    }
   }
 
   // Now determine the cgroup for the 'memory' subsystem.

http://git-wip-us.apache.org/repos/asf/mesos/blob/9029e434/src/slave/containerizer/docker.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.hpp b/src/slave/containerizer/docker.hpp
index 89d450e..79cd955 100644
--- a/src/slave/containerizer/docker.hpp
+++ b/src/slave/containerizer/docker.hpp
@@ -142,12 +142,9 @@ public:
       const process::PID<Slave>& slavePid,
       bool checkpoint);
 
-  // force = true causes the containerizer to update the resources
-  // for the container, even if they match what it has cached.
   virtual process::Future<Nothing> update(
       const ContainerID& containerId,
-      const Resources& resources,
-      bool force);
+      const Resources& resources);
 
   virtual process::Future<ResourceStatistics> usage(
       const ContainerID& containerId);