Apache Mesos
linux_launcher.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 __LINUX_LAUNCHER_HPP__
18 #define __LINUX_LAUNCHER_HPP__
19 
20 #include <process/owned.hpp>
21 
23 
24 namespace mesos {
25 namespace internal {
26 namespace slave {
27 
28 class LinuxLauncherProcess;
29 
30 // Launcher for Linux systems with cgroups. Uses a freezer cgroup to
31 // track pids.
32 class LinuxLauncher : public Launcher
33 {
34 public:
35  static Try<Launcher*> create(const Flags& flags);
36 
37  // Returns 'true' if prerequisites for using LinuxLauncher are available.
38  static bool available();
39 
40  // Helper for determining the cgroup for a container (i.e., the path
41  // in a cgroup subsystem).
42  static std::string cgroup(
43  const std::string& cgroupsRoot,
44  const ContainerID& containerId);
45 
46  ~LinuxLauncher() override;
47 
49  const std::vector<mesos::slave::ContainerState>& states) override;
50 
52  const ContainerID& containerId,
53  const std::string& path,
54  const std::vector<std::string>& argv,
55  const mesos::slave::ContainerIO& containerIO,
56  const flags::FlagsBase* flags,
57  const Option<std::map<std::string, std::string>>& environment,
58  const Option<int>& enterNamespaces,
59  const Option<int>& cloneNamespaces,
60  const std::vector<int_fd>& whitelistFds) override;
61 
62  process::Future<Nothing> destroy(const ContainerID& containerId) override;
63 
65  const ContainerID& containerId) override;
66 
67 private:
69  const Flags& flags,
70  const std::string& freezerHierarchy,
71  const Option<std::string>& systemdHierarchy);
72 
74 };
75 
76 } // namespace slave {
77 } // namespace internal {
78 } // namespace mesos {
79 
80 #endif // __LINUX_LAUNCHER_HPP__
Definition: path.hpp:26
Definition: launcher.hpp:47
Definition: option.hpp:28
Definition: check.hpp:33
process::Future< hashset< ContainerID > > recover(const std::vector< mesos::slave::ContainerState > &states) override
An abstraction around the IO classes used to redirect stdin/stdout/stderr to/from a container by the ...
Definition: containerizer.hpp:37
static std::string cgroup(const std::string &cgroupsRoot, const ContainerID &containerId)
Definition: flags.hpp:39
Environment * environment
process::Future< ContainerStatus > status(const ContainerID &containerId) override
Definition: linux_launcher.hpp:32
Definition: flags.hpp:44
Definition: spec.hpp:26
Try< pid_t > fork(const ContainerID &containerId, const std::string &path, const std::vector< std::string > &argv, const mesos::slave::ContainerIO &containerIO, const flags::FlagsBase *flags, const Option< std::map< std::string, std::string >> &environment, const Option< int > &enterNamespaces, const Option< int > &cloneNamespaces, const std::vector< int_fd > &whitelistFds) override
static Try< Launcher * > create(const Flags &flags)
Definition: attributes.hpp:24
Definition: executor.hpp:48
process::Future< Nothing > destroy(const ContainerID &containerId) override
Definition: parse.hpp:33
Definition: future.hpp:58