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/08/25 18:45:29 UTC

[3/8] mesos git commit: Removed 'status' in the destroy chain in MesosContainerizer.

Removed 'status' in the destroy chain in MesosContainerizer.

'status' is already part of the 'Container' struct. No need to pass it
in the destroy chain. This patch removed it.

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


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

Branch: refs/heads/master
Commit: 627c64687bc8d60086e98362509e20e98d4981fc
Parents: ba435cc
Author: Jie Yu <yu...@gmail.com>
Authored: Wed Aug 24 17:41:17 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Aug 25 11:45:23 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 54 ++++----------------
 src/slave/containerizer/mesos/containerizer.hpp |  6 +--
 2 files changed, 12 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/627c6468/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index d381d13..0b82a47 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1610,7 +1610,6 @@ void MesosContainerizerProcess::destroy(
           self(),
           &Self::____destroy,
           containerId,
-          None(),
           list<Future<Nothing>>()));
 
     return;
@@ -1633,11 +1632,7 @@ void MesosContainerizerProcess::destroy(
     // prevent a race that the destroy method calls the 'cleanup'
     // method of an isolator before the 'prepare' method is called.
     container->launchInfos
-      .onAny(defer(
-          self(),
-          &Self::___destroy,
-          containerId,
-          None()));
+      .onAny(defer(self(), &Self::___destroy, containerId));
 
     return;
   }
@@ -1651,10 +1646,7 @@ void MesosContainerizerProcess::destroy(
     // Wait for the isolators to finish isolating before we start
     // to destroy the container.
     container->isolation
-      .onAny(defer(
-          self(),
-          &Self::_destroy,
-          containerId));
+      .onAny(defer(self(), &Self::_destroy, containerId));
 
     return;
   }
@@ -1676,11 +1668,7 @@ void MesosContainerizerProcess::_destroy(
 
   // Kill all processes then continue destruction.
   launcher->destroy(containerId)
-    .onAny(defer(
-        self(),
-        &Self::__destroy,
-        containerId,
-        lambda::_1));
+    .onAny(defer(self(), &Self::__destroy, containerId, lambda::_1));
 }
 
 
@@ -1713,33 +1701,22 @@ void MesosContainerizerProcess::__destroy(
   // the exit status of the executor when it's ready (it may already
   // be) and continue the destroy.
   container->status
-    .onAny(defer(
-        self(),
-        &Self::___destroy,
-        containerId,
-        lambda::_1));
+    .onAny(defer(self(), &Self::___destroy, containerId));
 }
 
 
 void MesosContainerizerProcess::___destroy(
-    const ContainerID& containerId,
-    const Future<Option<int>>& status)
+    const ContainerID& containerId)
 {
   CHECK(containers_.contains(containerId));
 
   cleanupIsolators(containerId)
-    .onAny(defer(
-        self(),
-        &Self::____destroy,
-        containerId,
-        status,
-        lambda::_1));
+    .onAny(defer(self(), &Self::____destroy, containerId, lambda::_1));
 }
 
 
 void MesosContainerizerProcess::____destroy(
     const ContainerID& containerId,
-    const Future<Option<int>>& status,
     const Future<list<Future<Nothing>>>& cleanups)
 {
   // This should not occur because we only use the Future<list> to
@@ -1755,31 +1732,23 @@ void MesosContainerizerProcess::____destroy(
   foreach (const Future<Nothing>& cleanup, cleanups.get()) {
     if (!cleanup.isReady()) {
       container->promise.fail(
-          "Failed to clean up an isolator when destroying container '" +
-          stringify(containerId) + "': " +
-          (cleanup.isFailed() ? cleanup.failure() : "discarded future"));
+          "Failed to clean up an isolator when destroying container: " +
+          (cleanup.isFailed() ? cleanup.failure() : "discarded"));
 
       containers_.erase(containerId);
 
       ++metrics.container_destroy_errors;
-
       return;
     }
   }
 
   provisioner->destroy(containerId)
-    .onAny(defer(
-        self(),
-        &Self::_____destroy,
-        containerId,
-        status,
-        lambda::_1));
+    .onAny(defer(self(), &Self::_____destroy, containerId, lambda::_1));
 }
 
 
 void MesosContainerizerProcess::_____destroy(
     const ContainerID& containerId,
-    const Future<Option<int>>& status,
     const Future<bool>& destroy)
 {
   CHECK(containers_.contains(containerId));
@@ -1795,14 +1764,13 @@ void MesosContainerizerProcess::_____destroy(
     containers_.erase(containerId);
 
     ++metrics.container_destroy_errors;
-
     return;
   }
 
   ContainerTermination termination;
 
-  if (status.isReady() && status->isSome()) {
-    termination.set_status(status->get());
+  if (container->status.isReady() && container->status->isSome()) {
+    termination.set_status(container->status->get());
   }
 
   // NOTE: We may not see a limitation in time for it to be

http://git-wip-us.apache.org/repos/asf/mesos/blob/627c6468/src/slave/containerizer/mesos/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.hpp b/src/slave/containerizer/mesos/containerizer.hpp
index 681ee00..3e4fb97 100644
--- a/src/slave/containerizer/mesos/containerizer.hpp
+++ b/src/slave/containerizer/mesos/containerizer.hpp
@@ -232,21 +232,17 @@ private:
       const process::Future<Nothing>& future);
 
   // Continues '__destroy()' once we get the exit status of the executor.
-  void ___destroy(
-      const ContainerID& containerId,
-      const process::Future<Option<int>>& status);
+  void ___destroy(const ContainerID& containerId);
 
   // Continues '___destroy()' once all isolators have completed
   // cleanup.
   void ____destroy(
       const ContainerID& containerId,
-      const process::Future<Option<int>>& status,
       const process::Future<std::list<process::Future<Nothing>>>& cleanups);
 
   // Continues '____destroy()' once provisioner have completed destroy.
   void _____destroy(
       const ContainerID& containerId,
-      const process::Future<Option<int>>& status,
       const process::Future<bool>& destroy);
 
   // Call back for when an isolator limits a container and impacts the