17 #ifndef __PORT_MAPPING_ISOLATOR_HPP__ 18 #define __PORT_MAPPING_ISOLATOR_HPP__ 22 #include <sys/types.h> 72 return "/var/run/mesos/netns";
89 size_t _portsPerContainer)
91 portsPerContainer_(_portsPerContainer) {}
112 return (free + used).contains(ports);
118 static uint32_t nextMultipleOf(uint32_t x, uint32_t m);
124 size_t portsPerContainer_;
155 const std::vector<mesos::slave::ContainerState>& states,
159 const ContainerID& containerId,
160 const mesos::slave::ContainerConfig& containerConfig)
override;
163 const ContainerID& containerId,
167 const ContainerID& containerId)
override;
170 const ContainerID& containerId,
172 const google::protobuf::Map<
173 std::string, Value::Scalar>& resourceLimits = {})
override;
176 const ContainerID& containerId)
override;
179 const ContainerID& containerId)
override;
187 : nonEphemeralPorts(_nonEphemeralPorts),
188 ephemeralPorts(_ephemeralPorts),
253 const std::string& _bindMountRoot,
254 const std::string& _eth0,
255 const std::string& _lo,
258 const size_t _hostEth0MTU,
259 const net::IP& _hostDefaultGateway,
265 const std::set<uint16_t>& _flowIDs)
268 bindMountRoot(_bindMountRoot),
272 hostIPNetwork(_hostIPNetwork),
273 hostEth0MTU(_hostEth0MTU),
274 hostDefaultGateway(_hostDefaultGateway),
275 hostTxFqCodelHandle(_hostTxFqCodelHandle),
276 hostNetworkConfigurations(_hostNetworkConfigurations),
277 egressRateLimitPerContainer(_egressRateLimitPerContainer),
278 managedNonEphemeralPorts(_managedNonEphemeralPorts),
279 ephemeralPortsAllocator(_ephemeralPortsAllocator),
280 freeFlowIds(_flowIDs) {}
287 const ContainerID& containerId,
291 const ResourceStatistics& result,
295 ResourceStatistics result,
302 const std::string& veth);
306 const std::string& veth,
307 bool removeFiltersOnVeth =
true);
310 std::string scripts(Info* info);
312 uint16_t getNextFlowId();
315 const std::string bindMountRoot;
317 const std::string
eth0;
318 const std::string
lo;
321 const size_t hostEth0MTU;
322 const net::IP hostDefaultGateway;
340 std::set<uint16_t> freeFlowIds;
410 #endif // __PORT_MAPPING_ISOLATOR_HPP__ Protocol< RecoverRequest, RecoverResponse > recover
Try< Nothing > isolate(const std::string &hierarchy, const std::string &cgroup, pid_t pid)
std::string generate(const std::string &prefix="")
Returns 'prefix(N)' where N represents the number of instances where the same prefix (wrt...
Option< std::string > lo_name
Definition: port_mapping.hpp:362
EphemeralPortsAllocator(const IntervalSet< uint16_t > &total, size_t _portsPerContainer)
Definition: port_mapping.hpp:87
void execute(const std::string &script)
Try< bool > update(const std::string &link, const Handle &parent, uint16_t protocol, const action::Mirror &mirror)
Option< std::string > eth0_name
Definition: port_mapping.hpp:361
std::vector< routing::filter::ip::PortRange > getPortRanges(const IntervalSet< uint16_t > &ports)
constexpr char NET_ISOLATOR_BLOAT_REDUCTION[]
Definition: port_mapping.hpp:79
bool enable_snmp_statistics
Definition: port_mapping.hpp:394
Flags flags
Definition: port_mapping.hpp:370
PortMappingUpdate()
Definition: port_mapping.hpp:368
process::Future< bool > cleanup(const std::string &hierarchy)
Definition: port_mapping.hpp:386
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: handle.hpp:38
Definition: resources.hpp:83
constexpr char NET_ISOLATOR_BW_LIMIT[]
Definition: port_mapping.hpp:78
bool enable_socket_statistics_details
Definition: port_mapping.hpp:393
PortMappingStatistics()
Definition: port_mapping.hpp:397
std::string PORT_MAPPING_BIND_MOUNT_SYMLINK_ROOT()
Definition: port_mapping.hpp:70
Definition: counter.hpp:26
Definition: port_mapping.hpp:352
Flags flags
Definition: port_mapping.hpp:399
Represents a fork() exec()ed subprocess.
Definition: subprocess.hpp:44
DWORD pid_t
Definition: windows.hpp:181
Try< ResourceStatistics > usage(pid_t pid, bool mem=true, bool cpus=true)
flags::FlagsBase * getFlags() override
Definition: port_mapping.hpp:374
Definition: port_mapping.hpp:84
Definition: subcommand.hpp:41
Option< JSON::Object > ports_to_add
Definition: port_mapping.hpp:364
Definition: port_mapping.hpp:381
Try< std::vector< Info > > infos(int familiy, int states)
size_t portsPerContainer() const
Definition: port_mapping.hpp:94
Option< pid_t > pid
Definition: port_mapping.hpp:363
static const char * NAME
Definition: port_mapping.hpp:355
Option< pid_t > pid
Definition: port_mapping.hpp:391
Definition: port_mapping.hpp:357
Definition: isolator.hpp:82
flags::FlagsBase * getFlags() override
Definition: port_mapping.hpp:403
static const char * NAME
Definition: port_mapping.hpp:384
Definition: port_mapping.hpp:147
bool enable_socket_statistics_summary
Definition: port_mapping.hpp:392
#define flags
Definition: decoder.hpp:18
Definition: attributes.hpp:24
Option< std::string > eth0_name
Definition: port_mapping.hpp:390
void deallocate(const Interval< uint16_t > &ports)
std::string PORT_MAPPING_BIND_MOUNT_ROOT()
Definition: port_mapping.hpp:65
std::string PORT_MAPPING_VETH_PREFIX()
Definition: port_mapping.hpp:57
Try< std::string > prepare(const std::string &baseHierarchy, const std::string &subsystem, const std::string &cgroup)
bool isManaged(const Interval< uint16_t > &ports)
Definition: port_mapping.hpp:110
Try< Nothing > create(const std::string &hierarchy, const std::string &cgroup, bool recursive=false)
Result< std::string > lo()
Try< Interval< uint16_t > > allocate()
Result< std::string > eth0()
PID< MetricsProcess > metrics
~PortMappingIsolatorProcess() override
Definition: port_mapping.hpp:152
Option< JSON::Object > ports_to_remove
Definition: port_mapping.hpp:365