Apache Mesos
Public Member Functions | Static Public Member Functions | List of all members
mesos::internal::slave::Subsystem Class Reference

An abstraction for cgroups subsystem. More...

#include <subsystem.hpp>

Public Member Functions

 Subsystem (const Subsystem &)=delete
 
Subsystemoperator= (const Subsystem &)=delete
 
 ~Subsystem ()
 
std::string name () const
 The cgroups subsystem name of this Subsystem object. More...
 
process::Future< Nothingrecover (const ContainerID &containerId, const std::string &cgroup)
 Recover the cgroups subsystem for the associated container. More...
 
process::Future< Nothingprepare (const ContainerID &containerId, const std::string &cgroup, const mesos::slave::ContainerConfig &containerConfig)
 Prepare the cgroups subsystem for the associated container. More...
 
process::Future< Nothingisolate (const ContainerID &containerId, const std::string &cgroup, pid_t pid)
 Isolate the associated container to cgroups subsystem. More...
 
process::Future< mesos::slave::ContainerLimitation > watch (const ContainerID &containerId, const std::string &cgroup)
 Watch the container and report if any resource constraint impacts it. More...
 
process::Future< Nothingupdate (const ContainerID &containerId, const std::string &cgroup, const Resources &resourceRequests, const google::protobuf::Map< std::string, Value::Scalar > &resourceLimits={})
 Update resources allocated to the associated container in this cgroups subsystem. More...
 
process::Future< ResourceStatistics > usage (const ContainerID &containerId, const std::string &cgroup)
 Gather resource usage statistics of the cgroups subsystem for the associated container. More...
 
process::Future< ContainerStatus > status (const ContainerID &containerId, const std::string &cgroup)
 Get the run-time status of cgroups subsystem specific properties associated with the container. More...
 
process::Future< Nothingcleanup (const ContainerID &containerId, const std::string &cgroup)
 Clean up the cgroups subsystem for the associated container. More...
 

Static Public Member Functions

static Try< process::Owned< Subsystem > > create (const Flags &flags, const std::string &name, const std::string &hierarchy)
 Attempts to create a specific Subsystem object that will contain specific information associated with container. More...
 

Detailed Description

An abstraction for cgroups subsystem.

Constructor & Destructor Documentation

mesos::internal::slave::Subsystem::Subsystem ( const Subsystem )
delete
mesos::internal::slave::Subsystem::~Subsystem ( )

Member Function Documentation

process::Future<Nothing> mesos::internal::slave::Subsystem::cleanup ( const ContainerID &  containerId,
const std::string &  cgroup 
)

Clean up the cgroups subsystem for the associated container.

It will be called when destruction to ensure everything be cleanup. Similar to the isolator cleanup, it's likely that the cleanup for the subsystem is called for unknown containers (see MESOS-6059). We should ignore the cleanup request if the container is unknown to the subsystem.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
Returns
Nothing or an error if cleanup fails.
static Try<process::Owned<Subsystem> > mesos::internal::slave::Subsystem::create ( const Flags flags,
const std::string &  name,
const std::string &  hierarchy 
)
static

Attempts to create a specific Subsystem object that will contain specific information associated with container.

Parameters
flagsFlags used to launch the agent.
nameThe name of cgroups subsystem.
hierarchyThe hierarchy path of cgroups subsystem.
Returns
A specific Subsystem object or an error if create fails.
process::Future<Nothing> mesos::internal::slave::Subsystem::isolate ( const ContainerID &  containerId,
const std::string &  cgroup,
pid_t  pid 
)

Isolate the associated container to cgroups subsystem.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
pidThe process id of container.
Returns
Nothing or an error if isolate fails.
std::string mesos::internal::slave::Subsystem::name ( ) const

The cgroups subsystem name of this Subsystem object.

Returns
The cgroups subsystem name.
Subsystem& mesos::internal::slave::Subsystem::operator= ( const Subsystem )
delete
process::Future<Nothing> mesos::internal::slave::Subsystem::prepare ( const ContainerID &  containerId,
const std::string &  cgroup,
const mesos::slave::ContainerConfig &  containerConfig 
)

Prepare the cgroups subsystem for the associated container.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
containerConfigThe container configuration.
Returns
Nothing or an error if prepare fails.
process::Future<Nothing> mesos::internal::slave::Subsystem::recover ( const ContainerID &  containerId,
const std::string &  cgroup 
)

Recover the cgroups subsystem for the associated container.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
Returns
Nothing or an error if recover fails.
process::Future<ContainerStatus> mesos::internal::slave::Subsystem::status ( const ContainerID &  containerId,
const std::string &  cgroup 
)

Get the run-time status of cgroups subsystem specific properties associated with the container.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
Returns
The container status or an error if get fails.
process::Future<Nothing> mesos::internal::slave::Subsystem::update ( const ContainerID &  containerId,
const std::string &  cgroup,
const Resources resourceRequests,
const google::protobuf::Map< std::string, Value::Scalar > &  resourceLimits = {} 
)

Update resources allocated to the associated container in this cgroups subsystem.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
resourcesThe resources need to update.
Returns
Nothing or an error if update fails.
process::Future<ResourceStatistics> mesos::internal::slave::Subsystem::usage ( const ContainerID &  containerId,
const std::string &  cgroup 
)

Gather resource usage statistics of the cgroups subsystem for the associated container.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
Returns
The resource usage statistics or an error if gather statistics fails.
process::Future<mesos::slave::ContainerLimitation> mesos::internal::slave::Subsystem::watch ( const ContainerID &  containerId,
const std::string &  cgroup 
)

Watch the container and report if any resource constraint impacts it.

Parameters
containerIdThe target containerId.
cgroupThe target cgroup.
Returns
The resource limitation that impacts the container or an error if watch fails.

The documentation for this class was generated from the following file: