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/14 23:00:41 UTC
mesos git commit: Implemented docker volume driver isolator
interfaces.
Repository: mesos
Updated Branches:
refs/heads/master dba04cd8e -> 6a57889ce
Implemented docker volume driver isolator interfaces.
Review: https://reviews.apache.org/r/45217/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6a57889c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6a57889c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6a57889c
Branch: refs/heads/master
Commit: 6a57889ce9f3591084b7bd71805a0d24c3d9a5df
Parents: dba04cd
Author: Guangya Liu <gy...@gmail.com>
Authored: Thu Apr 14 14:00:05 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Apr 14 14:00:05 2016 -0700
----------------------------------------------------------------------
src/CMakeLists.txt | 1 +
src/Makefile.am | 2 +
.../mesos/isolators/docker/volume/isolator.cpp | 109 +++++++++++++++++++
.../mesos/isolators/docker/volume/isolator.hpp | 71 ++++++++++++
4 files changed, 183 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6a57889c/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca59a18..06f58c4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -140,6 +140,7 @@ set(LINUX_SRC
slave/containerizer/mesos/isolators/cgroups/net_cls.cpp
slave/containerizer/mesos/isolators/cgroups/perf_event.cpp
slave/containerizer/mesos/isolators/docker/runtime.cpp
+ slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
slave/containerizer/mesos/isolators/filesystem/linux.cpp
slave/containerizer/mesos/isolators/filesystem/posix.cpp
slave/containerizer/mesos/isolators/filesystem/shared.cpp
http://git-wip-us.apache.org/repos/asf/mesos/blob/6a57889c/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 139935f..1ae0ea7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -868,6 +868,7 @@ MESOS_LINUX_FILES = \
slave/containerizer/mesos/isolators/cgroups/net_cls.cpp \
slave/containerizer/mesos/isolators/cgroups/perf_event.cpp \
slave/containerizer/mesos/isolators/docker/runtime.cpp \
+ slave/containerizer/mesos/isolators/docker/volume/isolator.cpp \
slave/containerizer/mesos/isolators/filesystem/linux.cpp \
slave/containerizer/mesos/isolators/filesystem/shared.cpp \
slave/containerizer/mesos/isolators/namespaces/pid.cpp \
@@ -889,6 +890,7 @@ MESOS_LINUX_FILES += \
slave/containerizer/mesos/isolators/cgroups/net_cls.hpp \
slave/containerizer/mesos/isolators/cgroups/perf_event.hpp \
slave/containerizer/mesos/isolators/docker/runtime.hpp \
+ slave/containerizer/mesos/isolators/docker/volume/isolator.hpp \
slave/containerizer/mesos/isolators/filesystem/linux.hpp \
slave/containerizer/mesos/isolators/filesystem/shared.hpp \
slave/containerizer/mesos/isolators/namespaces/pid.hpp \
http://git-wip-us.apache.org/repos/asf/mesos/blob/6a57889c/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
new file mode 100644
index 0000000..0ad473d
--- /dev/null
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
@@ -0,0 +1,109 @@
+// 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 <list>
+
+#include "slave/flags.hpp"
+
+#include "slave/containerizer/mesos/isolators/docker/volume/isolator.hpp"
+
+using std::list;
+using std::string;
+
+using process::Failure;
+using process::Future;
+using process::Owned;
+using process::PID;
+
+using mesos::slave::ContainerConfig;
+using mesos::slave::ContainerLaunchInfo;
+using mesos::slave::ContainerLimitation;
+using mesos::slave::ContainerState;
+using mesos::slave::Isolator;
+
+namespace mesos {
+namespace internal {
+namespace slave {
+
+DockerVolumeIsolatorProcess::DockerVolumeIsolatorProcess(
+ const Flags& _flags)
+ : flags(_flags) {}
+
+
+DockerVolumeIsolatorProcess::~DockerVolumeIsolatorProcess() {}
+
+
+Try<Isolator*> DockerVolumeIsolatorProcess::create(const Flags& flags)
+{
+ return nullptr;
+}
+
+
+Future<Nothing> DockerVolumeIsolatorProcess::recover(
+ const list<ContainerState>& states,
+ const hashset<ContainerID>& orphans)
+{
+ return Nothing();
+}
+
+
+Future<Option<ContainerLaunchInfo>> DockerVolumeIsolatorProcess::prepare(
+ const ContainerID& containerId,
+ const ContainerConfig& containerConfig)
+{
+ return None();
+}
+
+
+Future<Nothing> DockerVolumeIsolatorProcess::isolate(
+ const ContainerID& containerId,
+ pid_t pid)
+{
+ return Nothing();
+}
+
+
+Future<ContainerLimitation> DockerVolumeIsolatorProcess::watch(
+ const ContainerID& containerId)
+{
+ return Future<ContainerLimitation>();
+}
+
+
+Future<Nothing> DockerVolumeIsolatorProcess::update(
+ const ContainerID& containerId,
+ const Resources& resources)
+{
+ return Nothing();
+}
+
+
+Future<ResourceStatistics> DockerVolumeIsolatorProcess::usage(
+ const ContainerID& containerId)
+{
+ return ResourceStatistics();
+}
+
+
+Future<Nothing> DockerVolumeIsolatorProcess::cleanup(
+ const ContainerID& containerId)
+{
+ return Nothing();
+}
+
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/6a57889c/src/slave/containerizer/mesos/isolators/docker/volume/isolator.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.hpp b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.hpp
new file mode 100644
index 0000000..786f917
--- /dev/null
+++ b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.hpp
@@ -0,0 +1,71 @@
+// 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 __DOCKER_VOLUME_ISOLATOR_HPP__
+#define __DOCKER_VOLUME_ISOLATOR_HPP__
+
+#include "slave/containerizer/mesos/isolator.hpp"
+
+namespace mesos {
+namespace internal {
+namespace slave {
+
+// The docker volume driver isolator is responsible for preparing
+// mesos container volumes by leveraging docker volume driver APIs, the
+// current volume isolator mainly support two APIs: mount and umount.
+class DockerVolumeIsolatorProcess : public MesosIsolatorProcess
+{
+public:
+ static Try<mesos::slave::Isolator*> create(const Flags& flags);
+
+ virtual ~DockerVolumeIsolatorProcess();
+
+ virtual process::Future<Nothing> recover(
+ const std::list<mesos::slave::ContainerState>& states,
+ const hashset<ContainerID>& orphans);
+
+ virtual process::Future<Option<mesos::slave::ContainerLaunchInfo>> prepare(
+ const ContainerID& containerId,
+ const mesos::slave::ContainerConfig& containerConfig);
+
+ virtual process::Future<Nothing> isolate(
+ const ContainerID& containerId,
+ pid_t pid);
+
+ virtual process::Future<mesos::slave::ContainerLimitation> watch(
+ const ContainerID& containerId);
+
+ virtual process::Future<Nothing> update(
+ const ContainerID& containerId,
+ const Resources& resources);
+
+ virtual process::Future<ResourceStatistics> usage(
+ const ContainerID& containerId);
+
+ virtual process::Future<Nothing> cleanup(
+ const ContainerID& containerId);
+
+private:
+ DockerVolumeIsolatorProcess(const Flags& flags);
+
+ const Flags flags;
+};
+
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // __DOCKER_VOLUME_ISOLATOR_HPP__