Apache Mesos
paths.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 __ISOLATOR_CNI_PATHS_HPP__
18 #define __ISOLATOR_CNI_PATHS_HPP__
19 
20 using std::string;
21 using std::list;
22 
23 namespace mesos {
24 namespace internal {
25 namespace slave {
26 namespace cni {
27 namespace paths {
28 
29 // The root directory where we keep the information of CNI networks that each
30 // container joins. The layout is as follows:
31 // /var/run/mesos/isolators/network/cni/
32 // |- <ID of Container1>/
33 // | |-- ns -> /proc/<pid>/ns/net (bind mount)
34 // | |-- <Name of CNI network 1>/
35 // | | |-- network.conf (JSON file to keep the CNI network configuration)
36 // | | |-- ifname1/
37 // | | |-- network.info (JSON file to keep the output of CNI plugin)
38 // | |-- <Name of CNI network 2>/
39 // | | |-- network.conf
40 // | |-- ifname2/
41 // | |-- network.info
42 // |-- <ID of ContainerID 2>/
43 // | ...
44 constexpr char ROOT_DIR[] = "/var/run/mesos/isolators/network/cni";
45 
46 
47 string getContainerDir(const string& rootDir, const string& containerId);
48 
49 
50 string getNamespacePath(const string& rootDir, const string& containerId);
51 
52 
53 string getNetworkDir(
54  const string& rootDir,
55  const string& containerId,
56  const string& networkName);
57 
58 
60  const string& rootDir,
61  const string& containerId);
62 
63 
65  const string& rootDir,
66  const string& containerId,
67  const string& networkName);
68 
69 
70 string getInterfaceDir(
71  const string& rootDir,
72  const string& containerId,
73  const string& networkName,
74  const string& ifName);
75 
76 
78  const string& rootDir,
79  const string& containerId,
80  const string& networkName);
81 
82 
83 string getNetworkInfoPath(
84  const string& rootDir,
85  const string& containerId,
86  const string& networkName,
87  const string& ifName);
88 
89 } // namespace paths {
90 } // namespace cni {
91 } // namespace slave {
92 } // namespace internal {
93 } // namespace mesos {
94 
95 #endif // __ISOLATOR_CNI_PATHS_HPP__
string getNetworkConfigPath(const string &rootDir, const string &containerId, const string &networkName)
Definition: try.hpp:34
string getNetworkInfoPath(const string &rootDir, const string &containerId, const string &networkName, const string &ifName)
std::string paths()
Definition: os.hpp:136
string getNamespacePath(const string &rootDir, const string &containerId)
Try< list< string > > getInterfaces(const string &rootDir, const string &containerId, const string &networkName)
string getContainerDir(const string &rootDir, const string &containerId)
string getInterfaceDir(const string &rootDir, const string &containerId, const string &networkName, const string &ifName)
string getNetworkDir(const string &rootDir, const string &containerId, const string &networkName)
Try< std::vector< Entry > > list(const std::string &hierarchy, const std::string &cgroup)
constexpr char ROOT_DIR[]
Definition: paths.hpp:44
Try< list< string > > getNetworkNames(const string &rootDir, const string &containerId)