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/10/03 22:28:48 UTC

mesos git commit: Fixed provisioner recovering with nested containers existed.

Repository: mesos
Updated Branches:
  refs/heads/master 2e013890e -> 8bab70c69


Fixed provisioner recovering with nested containers existed.

Previously, in provisioner recover, we firstly get all container
ids from the provisioner directory, and then find all rootfses
from each container's 'backends' directory. We made an assumption
that if a 'container_id' directory exists in the provisioner
directory, it must contain a 'backends' directory underneath,
which contains at least one rootfs for this container.

However, this is no longer true since we added support for nested
containers. Because we allow the case that a nested container is
specified with a container image while its parent does not have
an image specified. In this case, when the provisioner recovers,
it can still find the parent container's id in the provisioner
directory while no 'backends' directory exists, since all nested
containers backend information are under its parent container's
directory.

As a result, we should skip recovering the 'Info' struct in
provisioner for the parent container if it never provisions any
image.

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


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

Branch: refs/heads/master
Commit: 8bab70c691a3efeda301f72956de4f80b258464e
Parents: 2e01389
Author: Gilbert Song <so...@gmail.com>
Authored: Mon Oct 3 15:28:39 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Oct 3 15:28:39 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/provisioner/paths.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8bab70c6/src/slave/containerizer/mesos/provisioner/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/provisioner/paths.cpp b/src/slave/containerizer/mesos/provisioner/paths.cpp
index d9f87e3..d2de98b 100644
--- a/src/slave/containerizer/mesos/provisioner/paths.cpp
+++ b/src/slave/containerizer/mesos/provisioner/paths.cpp
@@ -183,6 +183,17 @@ Try<hashmap<string, hashset<string>>> listContainerRootfses(
           provisionerDir,
           containerId));
 
+  // It is possible that the 'backends' directory does not exist
+  // for a container ID that is present in the checkpoint directory
+  // because we allow the case where a nested container specifies a
+  // container image while its parent container does not. In this
+  // case, no image is provisioned for the parent container and the
+  // 'backends' directory does not exist, so we can skip recovering
+  // the parent container's `Info` in the provisioner.
+  if (!os::exists(backendsDir)) {
+    return results;
+  }
+
   Try<list<string>> backends = os::ls(backendsDir);
   if (backends.isError()) {
     return Error("Unable to list the container directory: " + backends.error());