You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2019/07/15 18:50:29 UTC

[mesos] 09/14: Fixed pid checkpointing for `TestContainerizer`.

This is an automated email from the ASF dual-hosted git repository.

grag pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 1a32b31496600e3ad5d54d8c4e8497e7ef420b18
Author: Benjamin Bannier <bb...@apache.org>
AuthorDate: Mon Jul 15 10:26:01 2019 -0700

    Fixed pid checkpointing for `TestContainerizer`.
    
    In order for a `MockExecutor` to be able to reregister after agent
    restart a persisted pid is required. This patch adds checkpointing of
    the pid.
    
    Review: https://reviews.apache.org/r/70906/
---
 src/tests/containerizer.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/tests/containerizer.cpp b/src/tests/containerizer.cpp
index fab7e81..3ac992f 100644
--- a/src/tests/containerizer.cpp
+++ b/src/tests/containerizer.cpp
@@ -163,6 +163,18 @@ public:
               ContentType::PROTOBUF, executor, fullEnvironment));
     }
 
+    // Checkpoint the forked pid if requested by the agent.
+    if (pidCheckpointPath.isSome()) {
+      Try<Nothing> checkpointed = slave::state::checkpoint(
+          pidCheckpointPath.get(), stringify(::getpid()));
+
+      if (checkpointed.isError()) {
+        LOG(ERROR) << "Failed to checkpoint container's forked pid to '"
+                   << pidCheckpointPath.get() << "': " << checkpointed.error();
+        return Failure("Could not checkpoint container's pid");
+      }
+    }
+
     return slave::Containerizer::LaunchResult::SUCCESS;
   }