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 2018/01/09 20:47:42 UTC

mesos git commit: Fixed the persistent volume permission issue in DockerContainerizer.

Repository: mesos
Updated Branches:
  refs/heads/master ca7d00025 -> c8e6487d2


Fixed the persistent volume permission issue in DockerContainerizer.

This patch fixes MESOS-8356 by skipping the current container to be
launched when doing the shared volume check (`isVolumeInUse`). Prior to
this patch, the code is buggy because `isVolumeInUse` will always be set
to `true`.

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


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

Branch: refs/heads/master
Commit: c8e6487d251d938c3c221f606f7e924514877655
Parents: ca7d000
Author: Jie Yu <yu...@gmail.com>
Authored: Tue Jan 9 11:23:20 2018 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Jan 9 12:47:30 2018 -0800

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c8e6487d/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 890cb2a..b42fe1f 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -532,8 +532,15 @@ Try<Nothing> DockerContainerizerProcess::updatePersistentVolumes(
 
     bool isVolumeInUse = false;
 
-    foreachvalue (const Container* container, containers_) {
-      if (container->resources.contains(resource)) {
+    foreachpair (const ContainerID& _containerId,
+                 const Container* _container,
+                 containers_) {
+      // Skip self.
+      if (_containerId == containerId) {
+        continue;
+      }
+
+      if (_container->resources.contains(resource)) {
         isVolumeInUse = true;
         break;
       }