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/04/20 20:57:45 UTC

mesos git commit: Added paths helper function for docker volume checkpoint.

Repository: mesos
Updated Branches:
  refs/heads/master c87930fe8 -> 17c954ac1


Added paths helper function for docker volume checkpoint.

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


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

Branch: refs/heads/master
Commit: 17c954ac1d395192d343eb62409d03e14b851e67
Parents: c87930f
Author: Guangya Liu <gy...@gmail.com>
Authored: Wed Apr 20 11:18:53 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Apr 20 11:54:04 2016 -0700

----------------------------------------------------------------------
 src/CMakeLists.txt                              |  1 +
 src/Makefile.am                                 |  2 +
 .../mesos/isolators/docker/volume/paths.cpp     | 46 ++++++++++++++++
 .../mesos/isolators/docker/volume/paths.hpp     | 57 ++++++++++++++++++++
 4 files changed, 106 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/17c954ac/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8e3eecb..a09e7ce 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -278,6 +278,7 @@ if (NOT WIN32)
     slave/containerizer/mesos/mount.cpp
     slave/containerizer/mesos/isolators/filesystem/posix.cpp
     slave/containerizer/mesos/isolators/posix/disk.cpp
+    slave/containerizer/mesos/isolators/docker/volume/paths.cpp
     slave/containerizer/mesos/isolators/network/cni/paths.cpp
     slave/containerizer/mesos/isolators/network/cni/spec.cpp
     slave/containerizer/mesos/provisioner/docker/local_puller.cpp

http://git-wip-us.apache.org/repos/asf/mesos/blob/17c954ac/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 08d5279..efd292f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -718,6 +718,7 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   slave/containerizer/mesos/launcher.cpp				\
   slave/containerizer/mesos/mount.cpp					\
   slave/containerizer/mesos/isolators/filesystem/posix.cpp		\
+  slave/containerizer/mesos/isolators/docker/volume/paths.cpp		\
   slave/containerizer/mesos/isolators/network/cni/paths.cpp		\
   slave/containerizer/mesos/isolators/network/cni/spec.cpp		\
   slave/containerizer/mesos/isolators/posix/disk.cpp			\
@@ -834,6 +835,7 @@ libmesos_no_3rdparty_la_SOURCES +=					\
   slave/containerizer/mesos/isolators/posix.hpp				\
   slave/containerizer/mesos/isolators/filesystem/posix.hpp		\
   slave/containerizer/mesos/isolators/posix/disk.hpp			\
+  slave/containerizer/mesos/isolators/docker/volume/paths.hpp		\
   slave/containerizer/mesos/isolators/docker/volume/state.hpp		\
   slave/containerizer/mesos/isolators/network/cni/paths.hpp		\
   slave/containerizer/mesos/isolators/network/cni/spec.hpp		\

http://git-wip-us.apache.org/repos/asf/mesos/blob/17c954ac/src/slave/containerizer/mesos/isolators/docker/volume/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/paths.cpp b/src/slave/containerizer/mesos/isolators/docker/volume/paths.cpp
new file mode 100644
index 0000000..6d69310
--- /dev/null
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/paths.cpp
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <stout/path.hpp>
+
+#include "slave/containerizer/mesos/isolators/docker/volume/paths.hpp"
+
+using std::string;
+
+namespace mesos {
+namespace internal {
+namespace slave {
+namespace docker {
+namespace volume {
+namespace paths {
+
+string getContainerDir(const string& rootDir, const string& containerId)
+{
+  return path::join(rootDir, containerId);
+}
+
+
+string getVolumesPath(const string& rootDir, const string& containerId)
+{
+  return path::join(getContainerDir(rootDir, containerId), "volumes");
+}
+
+} // namespace paths {
+} // namespace volume {
+} // namespace docker {
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/17c954ac/src/slave/containerizer/mesos/isolators/docker/volume/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/paths.hpp b/src/slave/containerizer/mesos/isolators/docker/volume/paths.hpp
new file mode 100644
index 0000000..1aff0d4
--- /dev/null
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/paths.hpp
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef __ISOLATOR_VOLUME_PATHS_HPP__
+#define __ISOLATOR_VOLUME_PATHS_HPP__
+
+#include <string>
+
+namespace mesos {
+namespace internal {
+namespace slave {
+namespace docker {
+namespace volume {
+namespace paths {
+
+// The root directory where we keep the information about volumes that
+// each container uses. The layout is as follows:
+//   /var/run/mesos/isolators/docker/volume
+//      |-- <ID of Container1>/
+//      |      |-- volumes
+//      |-- <ID of Container2>/
+//      |      |-- volumes
+//      |-- <ID of Container3>/
+//      |-- ...
+constexpr char ROOT_DIR[] = "/var/run/mesos/isolators/docker/volume";
+
+
+std::string getContainerDir(
+    const std::string& rootDir,
+    const std::string& containerId);
+
+
+std::string getVolumesPath(
+    const std::string& rootDir,
+    const std::string& containerId);
+
+} // namespace paths {
+} // namespace volume {
+} // namespace docker {
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // __ISOLATOR_VOLUME_PATHS_HPP__