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/21 00:53:02 UTC

[1/2] mesos git commit: Added an agent flag for 'runtime_dir'.

Repository: mesos
Updated Branches:
  refs/heads/master 6e4e5959b -> bb047cd72


Added an agent flag for 'runtime_dir'.

Currently, a number of agent components hard code a path
under '/var/run/mesos' in order to persist runtime information across
agent crashes. This path should be configurable.

This commit adds an agent flag to make this runtime directory
configurable. It only lays the groundwork for migrating all of the
hard coded paths. It doesn't actually modify these components yet.
That will come in subsequent commits.

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


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

Branch: refs/heads/master
Commit: c59f5b18d5b5f5e4bd0a6f40c399b5b86496715e
Parents: 6e4e595
Author: Kevin Klues <kl...@gmail.com>
Authored: Sat Aug 20 17:52:53 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Sat Aug 20 17:52:53 2016 -0700

----------------------------------------------------------------------
 src/slave/constants.hpp                         | 5 +++++
 src/slave/flags.cpp                             | 8 ++++++++
 src/slave/flags.hpp                             | 1 +
 src/tests/balloon_framework_test.sh             | 7 +++++++
 src/tests/disk_full_framework_test.sh           | 6 ++++++
 src/tests/dynamic_reservation_framework_test.sh | 5 +++++
 src/tests/java_exception_test.sh                | 5 +++++
 src/tests/java_framework_test.sh                | 5 +++++
 src/tests/java_v0_framework_test.sh             | 5 +++++
 src/tests/java_v1_framework_test.sh             | 5 +++++
 src/tests/mesos.cpp                             | 7 ++++++-
 src/tests/no_executor_framework_test.sh         | 5 +++++
 src/tests/persistent_volume_framework_test.sh   | 5 +++++
 src/tests/python_framework_test.sh              | 5 +++++
 src/tests/test_framework_test.sh                | 5 +++++
 src/tests/test_http_framework_test.sh           | 5 +++++
 16 files changed, 83 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/slave/constants.hpp
----------------------------------------------------------------------
diff --git a/src/slave/constants.hpp b/src/slave/constants.hpp
index 360dd05..0ad59ad 100644
--- a/src/slave/constants.hpp
+++ b/src/slave/constants.hpp
@@ -137,6 +137,11 @@ constexpr Bytes DEFAULT_FETCHER_CACHE_SIZE = Gigabytes(2);
 // trigger a re-detection of the master to cause a re-registration.
 Duration DEFAULT_MASTER_PING_TIMEOUT();
 
+// Default path of the agent runtime directory. This is where runtime
+// data is stored by an agent that it needs to persist across crashes
+// (but not across reboots). This directory will be cleared on reboot.
+constexpr char DEFAULT_RUNTIME_DIRECTORY[] = "/var/run/mesos";
+
 } // namespace slave {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index c07d6e5..0f2be17 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -190,6 +190,14 @@ mesos::internal::slave::Flags::Flags()
       "production, since long-running agents could lose data when cleanup\n"
       "occurs. (Example: `/var/lib/mesos/agent`)");
 
+  add(&Flags::runtime_dir,
+      "runtime_dir",
+      "Path of the agent runtime directory. This is where runtime data\n"
+      "is stored by an agent that it needs to persist across crashes (but\n"
+      "not across reboots). This directory will be cleared on reboot.\n"
+      "(Example: `/var/run/mesos`)",
+      DEFAULT_RUNTIME_DIRECTORY);
+
   add(&Flags::launcher_dir, // TODO(benh): This needs a better name.
       "launcher_dir",
       "Directory path of Mesos binaries. Mesos looks for the health-check,\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index ef2394c..1a00666 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -62,6 +62,7 @@ public:
   Bytes fetcher_cache_size;
   std::string fetcher_cache_dir;
   std::string work_dir;
+  std::string runtime_dir;
   std::string launcher_dir;
   std::string hadoop_home; // TODO(benh): Make an Option.
 #ifndef __WINDOWS__

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/balloon_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/balloon_framework_test.sh b/src/tests/balloon_framework_test.sh
index 5d013fc..0b135a6 100755
--- a/src/tests/balloon_framework_test.sh
+++ b/src/tests/balloon_framework_test.sh
@@ -27,6 +27,7 @@ fi
 MASTER_PID=
 AGENT_PID=
 MESOS_WORK_DIR=
+MESOS_RUNTIME_DIR=
 
 # This function ensures that we first kill the agent (if present) and
 # then cleanup the cgroups. This is necessary because a running agent
@@ -57,6 +58,10 @@ function cleanup() {
   if [[ -d "${MESOS_WORK_DIR}" ]]; then
     rm -rf ${MESOS_WORK_DIR};
   fi
+
+  if [[ -d "${MESOS_RUNTIME_DIR}" ]]; then
+    rm -rf ${MESOS_RUNTIME_DIR};
+  fi
 }
 
 atexit cleanup
@@ -75,6 +80,7 @@ unset MESOS_HELPER_DIR
 unset MESOS_VERBOSE
 
 MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
 
 # Launch master.
 ${MASTER} \
@@ -98,6 +104,7 @@ EXECUTOR_ENVIRONMENT_VARIABLES="{\"LD_LIBRARY_PATH\":\"${LD_LIBRARY_PATH}\"}"
 # Launch agent.
 ${AGENT} \
     --work_dir=${MESOS_WORK_DIR} \
+    --runtime_dir=${MESOS_RUNTIME_DIR} \
     --master=127.0.0.1:5432 \
     --isolation=cgroups/mem \
     --cgroups_hierarchy=${TEST_CGROUP_HIERARCHY} \

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/disk_full_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/disk_full_framework_test.sh b/src/tests/disk_full_framework_test.sh
index 7b84d81..e13d467 100755
--- a/src/tests/disk_full_framework_test.sh
+++ b/src/tests/disk_full_framework_test.sh
@@ -11,6 +11,7 @@ source ${MESOS_HELPER_DIR}/atexit.sh
 MASTER_PID=
 AGENT_PID=
 MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
 
 function cleanup() {
   # Make sure we kill the master on exit.
@@ -26,6 +27,10 @@ function cleanup() {
   if [[ -d "${MESOS_WORK_DIR}" ]]; then
     rm -rf ${MESOS_WORK_DIR};
   fi
+
+  if [[ -d "${MESOS_RUNTIME_DIR}" ]]; then
+    rm -rf ${MESOS_RUNTIME_DIR};
+  fi
 }
 
 atexit cleanup
@@ -67,6 +72,7 @@ export MESOS_SYSTEMD_ENABLE_SUPPORT=false
 # Launch agent.
 ${AGENT} \
     --work_dir=${MESOS_WORK_DIR} \
+    --runtime_dir=${MESOS_RUNTIME_DIR} \
     --master=127.0.0.1:5432 \
     --isolation='disk/du' \
     --enforce_container_disk_quota \

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/dynamic_reservation_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/dynamic_reservation_framework_test.sh b/src/tests/dynamic_reservation_framework_test.sh
index 5e664c8..c094ed1 100755
--- a/src/tests/dynamic_reservation_framework_test.sh
+++ b/src/tests/dynamic_reservation_framework_test.sh
@@ -24,6 +24,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/java_exception_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/java_exception_test.sh b/src/tests/java_exception_test.sh
index fdafc45..9692b21 100755
--- a/src/tests/java_exception_test.sh
+++ b/src/tests/java_exception_test.sh
@@ -21,6 +21,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/java_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/java_framework_test.sh b/src/tests/java_framework_test.sh
index b2d7481..c53e4ab 100755
--- a/src/tests/java_framework_test.sh
+++ b/src/tests/java_framework_test.sh
@@ -21,6 +21,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/java_v0_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/java_v0_framework_test.sh b/src/tests/java_v0_framework_test.sh
index 12daae4..5b60225 100755
--- a/src/tests/java_v0_framework_test.sh
+++ b/src/tests/java_v0_framework_test.sh
@@ -21,6 +21,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/java_v1_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/java_v1_framework_test.sh b/src/tests/java_v1_framework_test.sh
index c49e11c..63f35d9 100755
--- a/src/tests/java_v1_framework_test.sh
+++ b/src/tests/java_v1_framework_test.sh
@@ -21,6 +21,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Set the connection delay to 0 to speed up the tests.
 export MESOS_CONNECTION_DELAY_MAX=0ms;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 62e8fcc..f5034f9 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -165,8 +165,13 @@ slave::Flags MesosTest::CreateSlaveFlags()
   // Create a temporary work directory (removed by Environment).
   Try<string> directory = environment->mkdtemp();
   CHECK_SOME(directory) << "Failed to create temporary directory";
-
   flags.work_dir = directory.get();
+
+  // Create a temporary runtime directory (removed by Environment).
+  directory = environment->mkdtemp();
+  CHECK_SOME(directory) << "Failed to create temporary directory";
+  flags.runtime_dir = directory.get();
+
   flags.fetcher_cache_dir = path::join(directory.get(), "fetch");
 
   flags.launcher_dir = getLauncherDir();

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/no_executor_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/no_executor_framework_test.sh b/src/tests/no_executor_framework_test.sh
index 29c952d..df282ca 100755
--- a/src/tests/no_executor_framework_test.sh
+++ b/src/tests/no_executor_framework_test.sh
@@ -24,6 +24,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/persistent_volume_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/persistent_volume_framework_test.sh b/src/tests/persistent_volume_framework_test.sh
index 6a80719..2ab22c0 100755
--- a/src/tests/persistent_volume_framework_test.sh
+++ b/src/tests/persistent_volume_framework_test.sh
@@ -25,6 +25,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/python_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/python_framework_test.sh b/src/tests/python_framework_test.sh
index 74427b4..58beb9e 100755
--- a/src/tests/python_framework_test.sh
+++ b/src/tests/python_framework_test.sh
@@ -21,6 +21,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/test_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/test_framework_test.sh b/src/tests/test_framework_test.sh
index 73b4ddc..8782e01 100755
--- a/src/tests/test_framework_test.sh
+++ b/src/tests/test_framework_test.sh
@@ -25,6 +25,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms

http://git-wip-us.apache.org/repos/asf/mesos/blob/c59f5b18/src/tests/test_http_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/test_http_framework_test.sh b/src/tests/test_http_framework_test.sh
index b724203..256655d 100755
--- a/src/tests/test_http_framework_test.sh
+++ b/src/tests/test_http_framework_test.sh
@@ -24,6 +24,11 @@ MESOS_WORK_DIR=`mktemp -d -t mesos-XXXXXX`
 atexit "rm -rf ${MESOS_WORK_DIR}"
 export MESOS_WORK_DIR=${MESOS_WORK_DIR}
 
+MESOS_RUNTIME_DIR=`mktemp -d -t mesos-XXXXXX`
+
+atexit "rm -rf ${MESOS_RUNTIME_DIR}"
+export MESOS_RUNTIME_DIR=${MESOS_RUNTIME_DIR}
+
 # Lower the authentication timeout to speed up the test (the master
 # may drop the authentication message while it is recovering).
 export MESOS_AUTHENTICATION_TIMEOUT=200ms


[2/2] mesos git commit: Added extra functions to the 'Launcher' abstraction.

Posted by ji...@apache.org.
Added extra functions to the 'Launcher' abstraction.

The functions added in this commit are not currently used anywhere in
the code base. However, they are required for some changes we are
making in order to persist container state in cases where an agent
crashes. The changes to use these function will come in subsequent
commits.

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


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

Branch: refs/heads/master
Commit: bb047cd72936aa1836b6e959127a572c72fb824b
Parents: c59f5b1
Author: Kevin Klues <kl...@gmail.com>
Authored: Sat Aug 20 17:52:56 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Sat Aug 20 17:52:56 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/launcher.cpp      | 43 +++++++++++++++++++-
 src/slave/containerizer/mesos/launcher.hpp      | 26 +++++++++++-
 .../containerizer/mesos/linux_launcher.cpp      | 15 +++++++
 .../containerizer/mesos/linux_launcher.hpp      |  3 ++
 src/tests/containerizer/launcher.hpp            |  4 ++
 5 files changed, 87 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bb047cd7/src/slave/containerizer/mesos/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.cpp b/src/slave/containerizer/mesos/launcher.cpp
index 9efe847..413a8af 100644
--- a/src/slave/containerizer/mesos/launcher.cpp
+++ b/src/slave/containerizer/mesos/launcher.cpp
@@ -21,6 +21,7 @@
 #include <process/process.hpp>
 #include <process/reap.hpp>
 
+#include <stout/path.hpp>
 #include <stout/unreachable.hpp>
 
 #include <stout/os/killtree.hpp>
@@ -46,9 +47,35 @@ namespace mesos {
 namespace internal {
 namespace slave {
 
+constexpr char POSIX_LAUNCHER_NAME[] = "posix";
+
+
+string Launcher::buildPathFromHierarchy(
+    const ContainerID& _containerId,
+    const string& prefix)
+{
+  // Build the path in reverse order
+  // by following the parent hierarchy.
+  ContainerID containerId = _containerId;
+
+  string path = path::join(prefix, containerId.value());
+
+  while (containerId.has_parent()) {
+    containerId = containerId.parent();
+
+    path = path::join(
+        prefix,
+        containerId.value(),
+        path);
+  }
+
+  return path;
+}
+
+
 Try<Launcher*> PosixLauncher::create(const Flags& flags)
 {
-  return new PosixLauncher();
+  return new PosixLauncher(flags);
 }
 
 
@@ -181,9 +208,21 @@ Future<ContainerStatus> PosixLauncher::status(const ContainerID& containerId)
 }
 
 
+string PosixLauncher::getExitStatusCheckpointPath(
+    const ContainerID& containerId)
+{
+  return path::join(
+      flags.runtime_dir,
+      "launcher",
+      POSIX_LAUNCHER_NAME,
+      buildPathFromHierarchy(containerId, "containers"),
+      "exit_status");
+}
+
+
 Try<Launcher*> WindowsLauncher::create(const Flags& flags)
 {
-  return new WindowsLauncher();
+  return new WindowsLauncher(flags);
 }
 
 } // namespace slave {

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb047cd7/src/slave/containerizer/mesos/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.hpp b/src/slave/containerizer/mesos/launcher.hpp
index bf435e3..0eae095 100644
--- a/src/slave/containerizer/mesos/launcher.hpp
+++ b/src/slave/containerizer/mesos/launcher.hpp
@@ -80,6 +80,21 @@ public:
   // Currently only returns Executor PID info.
   virtual process::Future<ContainerStatus> status(
       const ContainerID& containerId) = 0;
+
+  // Get the the path where to checkpoint the
+  // exit status of the container with `containerId`.
+  virtual std::string getExitStatusCheckpointPath(
+      const ContainerID& containerId) = 0;
+
+protected:
+  // Build a path based on a hierarchy of containers whose leaf container
+  // is `containerId`. The `prefix` parameter is prepended to the
+  // `containerId` as we build the path up the tree (e.g. passing a
+  // `containersId` with a value of 3 and a prefix of `foo` would
+  // result in .../foo/1/foo/2/foo/3).
+  std::string buildPathFromHierarchy(
+      const ContainerID& containerId,
+      const string& prefix);
 };
 
 
@@ -115,12 +130,18 @@ public:
   virtual process::Future<ContainerStatus> status(
       const ContainerID& containerId);
 
+  virtual std::string getExitStatusCheckpointPath(
+      const ContainerID& containerId);
+
 protected:
-  PosixLauncher() {}
+  PosixLauncher(const Flags& _flags)
+    : flags(_flags) {}
 
   // The 'pid' is the process id of the first process and also the
   // process group id and session id.
   hashmap<ContainerID, pid_t> pids;
+
+  const Flags flags;
 };
 
 
@@ -134,7 +155,8 @@ public:
   virtual ~WindowsLauncher() {}
 
 private:
-  WindowsLauncher() {}
+  WindowsLauncher(const Flags& flags)
+    : PosixLauncher(flags) {}
 };
 
 } // namespace slave {

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb047cd7/src/slave/containerizer/mesos/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.cpp b/src/slave/containerizer/mesos/linux_launcher.cpp
index 95dee95..7377316 100644
--- a/src/slave/containerizer/mesos/linux_launcher.cpp
+++ b/src/slave/containerizer/mesos/linux_launcher.cpp
@@ -54,6 +54,9 @@ namespace mesos {
 namespace internal {
 namespace slave {
 
+constexpr char LINUX_LAUNCHER_NAME[] = "linux";
+
+
 static ContainerID container(const string& cgroup)
 {
   string basename = Path(cgroup).basename();
@@ -379,6 +382,18 @@ Future<ContainerStatus> LinuxLauncher::status(const ContainerID& containerId)
 }
 
 
+string LinuxLauncher::getExitStatusCheckpointPath(
+    const ContainerID& containerId)
+{
+  return path::join(
+      flags.runtime_dir,
+      "launcher",
+      LINUX_LAUNCHER_NAME,
+      buildPathFromHierarchy(containerId, "containers"),
+      "exit_status");
+}
+
+
 string LinuxLauncher::cgroup(const ContainerID& containerId)
 {
   return path::join(flags.cgroups_root, containerId.value());

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb047cd7/src/slave/containerizer/mesos/linux_launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.hpp b/src/slave/containerizer/mesos/linux_launcher.hpp
index c185222..8fbe1e9 100644
--- a/src/slave/containerizer/mesos/linux_launcher.hpp
+++ b/src/slave/containerizer/mesos/linux_launcher.hpp
@@ -55,6 +55,9 @@ public:
   virtual process::Future<ContainerStatus> status(
       const ContainerID& containerId);
 
+  virtual std::string getExitStatusCheckpointPath(
+      const ContainerID& containerId);
+
 private:
   LinuxLauncher(
       const Flags& flags,

http://git-wip-us.apache.org/repos/asf/mesos/blob/bb047cd7/src/tests/containerizer/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launcher.hpp b/src/tests/containerizer/launcher.hpp
index 7e5c243..94c62b7 100644
--- a/src/tests/containerizer/launcher.hpp
+++ b/src/tests/containerizer/launcher.hpp
@@ -78,6 +78,10 @@ public:
       status,
       process::Future<ContainerStatus>(const ContainerID& containerId));
 
+  MOCK_METHOD1(
+      getExitStatusCheckpointPath,
+      std::string(const ContainerID& containerId));
+
   process::Owned<slave::Launcher> real;
 };