You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2019/07/12 08:39:24 UTC
[mesos] 02/03: Implemented `cleanup` method of the `namespaces/ipc`
isolator.
This is an automated email from the ASF dual-hosted git repository.
gilbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit eb9af952d5f43d7f0b91ef01acc624e64d6c0ae7
Author: Qian Zhang <zh...@gmail.com>
AuthorDate: Fri Jul 12 00:40:09 2019 -0700
Implemented `cleanup` method of the `namespaces/ipc` isolator.
Review: https://reviews.apache.org/r/70844/
---
.../containerizer/mesos/isolators/namespaces/ipc.cpp | 19 +++++++++++++++++++
.../containerizer/mesos/isolators/namespaces/ipc.hpp | 3 +++
2 files changed, 22 insertions(+)
diff --git a/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp b/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp
index 327827f..9a98476 100644
--- a/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp
+++ b/src/slave/containerizer/mesos/isolators/namespaces/ipc.cpp
@@ -322,6 +322,25 @@ Future<Option<ContainerLaunchInfo>> NamespacesIPCIsolatorProcess::prepare(
return launchInfo;
}
+
+Future<Nothing> NamespacesIPCIsolatorProcess::cleanup(
+ const ContainerID& containerId)
+{
+ const string shmPath = containerizer::paths::getContainerShmPath(
+ flags.runtime_dir, containerId);
+
+ if (os::exists(shmPath)) {
+ Try<Nothing> unmount = fs::unmount(shmPath);
+ if (unmount.isError()) {
+ return Failure(
+ "Failed to unmount container shared memory directory '" +
+ shmPath + "': " + unmount.error());
+ }
+ }
+
+ return Nothing();
+}
+
} // namespace slave {
} // namespace internal {
} // namespace mesos {
diff --git a/src/slave/containerizer/mesos/isolators/namespaces/ipc.hpp b/src/slave/containerizer/mesos/isolators/namespaces/ipc.hpp
index 00c9d7e..ef252fe 100644
--- a/src/slave/containerizer/mesos/isolators/namespaces/ipc.hpp
+++ b/src/slave/containerizer/mesos/isolators/namespaces/ipc.hpp
@@ -39,6 +39,9 @@ public:
const ContainerID& containerId,
const mesos::slave::ContainerConfig& containerConfig) override;
+ process::Future<Nothing> cleanup(
+ const ContainerID& containerId) override;
+
private:
NamespacesIPCIsolatorProcess(const Flags& flags);