Apache Mesos
bind.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __PROVISIONER_BACKENDS_BIND_HPP__
18 #define __PROVISIONER_BACKENDS_BIND_HPP__
19 
21 
22 namespace mesos {
23 namespace internal {
24 namespace slave {
25 
26 // Forward declaration.
27 class BindBackendProcess;
28 
29 
30 // This is a specialized backend that may be useful for deployments
31 // using large (multi-GB) single-layer images *and* where more recent
32 // kernel features such as overlayfs are not available (overlayfs-based
33 // backend tracked by MESOS-2971). For small images (10's to 100's of MB)
34 // the copy backend may be sufficient. NOTE:
35 // 1) BindBackend supports only a single layer. Multi-layer images will
36 // fail to provision and the container will fail to launch!
37 // 2) The filesystem is read-only because all containers using this
38 // image share the source. Select writable areas can be achieved by
39 // mounting read-write volumes to places like /tmp, /var/tmp,
40 // /home, etc. using the ContainerInfo. These can be relative to
41 // the executor work directory.
42 // N.B. Since the filesystem is read-only:
43 // i. The '--sandbox_directory' must already exist within the
44 // filesystem because the filesystem isolator is unable to
45 // create it!
46 // ii. The 'tmpfs' moint point '/tmp' must already exist within
47 // the filesystem, because 'pivot_root' needs a mount point
48 // for the old root.
49 // 3) It's fast because the bind mount requires (nearly) zero IO.
50 class BindBackend : public Backend
51 {
52 public:
53  virtual ~BindBackend();
54 
55  // BindBackend doesn't use any flag.
57 
59  const std::vector<std::string>& layers,
60  const std::string& rootfs,
61  const std::string& backendDir);
62 
64  const std::string& rootfs,
65  const std::string& backendDir);
66 
67 private:
69 
70  BindBackend(const BindBackend&); // Not copyable.
71  BindBackend& operator=(const BindBackend&); // Not assignable.
72 
74 };
75 
76 } // namespace slave {
77 } // namespace internal {
78 } // namespace mesos {
79 
80 #endif // __PROVISIONER_BACKENDS_BIND_HPP__
virtual process::Future< Nothing > provision(const std::vector< std::string > &layers, const std::string &rootfs, const std::string &backendDir)
Definition: try.hpp:34
Definition: flags.hpp:39
Definition: backend.hpp:36
virtual process::Future< bool > destroy(const std::string &rootfs, const std::string &backendDir)
static Try< process::Owned< Backend > > create(const Flags &)