Repository: mesos
Updated Branches:
  refs/heads/master d0bb88470 -> 6435d46c8


Introduced provisioner Backend interface.

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


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

Branch: refs/heads/master
Commit: 6435d46c83e7c24b385b76d2d06ab79cbf7f078c
Parents: d0bb884
Author: Jiang Yan Xu <y...@jxu.me>
Authored: Tue Aug 11 22:18:51 2015 -0700
Committer: Jiang Yan Xu <y...@jxu.me>
Committed: Wed Aug 19 15:37:05 2015 -0700

----------------------------------------------------------------------
 src/Makefile.am                                 |  2 +
 .../containerizer/provisioners/backend.cpp      | 39 ++++++++++++
 .../containerizer/provisioners/backend.hpp      | 62 ++++++++++++++++++++
 3 files changed, 103 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6435d46c/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 457ad26..9fd71d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -472,6 +472,7 @@ libmesos_no_3rdparty_la_SOURCES =                           
        \
        slave/containerizer/provisioners/appc/paths.cpp                 \
        slave/containerizer/provisioners/appc/spec.cpp                  \
        slave/containerizer/provisioners/appc/store.cpp                 \
+       slave/containerizer/provisioners/backend.cpp                    \
        slave/resource_estimators/noop.cpp                              \
        usage/usage.cpp                                                 \
        v1/attributes.cpp                                               \
@@ -739,6 +740,7 @@ libmesos_no_3rdparty_la_SOURCES +=                          
        \
        slave/containerizer/provisioners/appc/paths.hpp                 \
        slave/containerizer/provisioners/appc/spec.hpp                  \
        slave/containerizer/provisioners/appc/store.hpp                 \
+       slave/containerizer/provisioners/backend.hpp                    \
        slave/containerizer/isolators/posix.hpp                         \
        slave/containerizer/isolators/posix/disk.hpp                    \
        slave/containerizer/isolators/cgroups/constants.hpp             \

http://git-wip-us.apache.org/repos/asf/mesos/blob/6435d46c/src/slave/containerizer/provisioners/backend.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/backend.cpp 
b/src/slave/containerizer/provisioners/backend.cpp
new file mode 100644
index 0000000..6190ce3
--- /dev/null
+++ b/src/slave/containerizer/provisioners/backend.cpp
@@ -0,0 +1,39 @@
+/**
+ * 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 "slave/containerizer/provisioners/backend.hpp"
+
+using namespace process;
+
+using std::list;
+using std::string;
+using std::vector;
+
+namespace mesos {
+namespace internal {
+namespace slave {
+
+Try<Owned<Backend>> Backend::create(const Flags& flags)
+{
+  // TODO(xujyan): Load backend implementations once they are introduced.
+  return Error("No Backend implementation available");
+}
+
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/6435d46c/src/slave/containerizer/provisioners/backend.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/provisioners/backend.hpp 
b/src/slave/containerizer/provisioners/backend.hpp
new file mode 100644
index 0000000..46120e8
--- /dev/null
+++ b/src/slave/containerizer/provisioners/backend.hpp
@@ -0,0 +1,62 @@
+/**
+ * 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 __MESOS_PROVISIONER_BACKEND_HPP__
+#define __MESOS_PROVISIONER_BACKEND_HPP__
+
+#include <string>
+#include <vector>
+
+#include <process/future.hpp>
+#include <process/owned.hpp>
+
+#include <stout/try.hpp>
+
+#include "slave/flags.hpp"
+
+namespace mesos {
+namespace internal {
+namespace slave {
+
+// Provision a root filesystem for a container.
+class Backend
+{
+public:
+  virtual ~Backend() {}
+
+  static Try<process::Owned<Backend>> create(const Flags& flags);
+
+  // Provision a root filesystem for a container into the specified 'rootfs'
+  // directory by applying the specified list of root filesystem layers in
+  // the list order, i.e., files in a layer can overwrite/shadow those from
+  // another layer earlier in the list.
+  virtual process::Future<Nothing> provision(
+      const std::vector<std::string>& layers,
+      const std::string& rootfs) = 0;
+
+  // Destroy the root filesystem provisioned at the specified 'rootfs'
+  // directory. Return false if there is no provisioned root filesystem
+  // to destroy for the given directory.
+  virtual process::Future<bool> destroy(const std::string& rootfs) = 0;
+};
+
+} // namespace slave {
+} // namespace internal {
+} // namespace mesos {
+
+#endif // __MESOS_PROVISIONER_BACKEND_HPP__

Reply via email to