#include <container-impl.hpp>
Public Types | |
enum | State { State::STOPPED, State::STOPPING, State::STARTING, State::RUNNING } |
typedef std::function< void(void)> | Callback |
Public Member Functions | |
ContainerImpl (const std::string &name, const std::string &rootPath, const std::string &workPath) | |
~ContainerImpl () | |
const std::string & | getName () const |
Configuration. More... | |
const std::string & | getRootPath () const |
void | setHostName (const std::string &hostname) |
pid_t | getGuardPid () const |
pid_t | getInitPid () const |
const std::vector< std::string > & | getInit () |
void | setInit (const std::vector< std::string > &init) |
void | setLogger (const logger::LogType type, const logger::LogLevel level, const std::string &arg) |
void | setTerminalCount (const unsigned int count) |
void | addUIDMap (unsigned min, unsigned max, unsigned num) |
void | addGIDMap (unsigned min, unsigned max, unsigned num) |
void | start () |
Execution actions. More... | |
void | stop () |
void | freeze () |
void | unfreeze () |
void | reboot () |
Container::State | getState () |
States. More... | |
void | setStartedCallback (const Container::Callback &callback) |
void | setStoppedCallback (const Container::Callback &callback) |
int | attach (const std::vector< std::string > &argv, const uid_t uid, const gid_t gid, const std::string &ttyPath, const std::vector< gid_t > &supplementaryGids, const int capsToKeep, const std::string &workDirInContainer, const std::vector< std::string > &envToKeep, const std::vector< std::pair< std::string, std::string >> &envToSet) |
Other. More... | |
void | console () |
void | addInterfaceConfig (const std::string &hostif, const std::string &zoneif, InterfaceType type, const std::vector< InetAddr > &addrs, MacVLanMode mode) |
adds interface configration. More... | |
void | addInetConfig (const std::string &ifname, const InetAddr &addr) |
std::vector< std::string > | getInterfaces () const |
Network interfaces (runtime) More... | |
NetworkInterfaceInfo | getInterfaceInfo (const std::string &ifname) const |
void | createInterface (const std::string &hostif, const std::string &zoneif, InterfaceType type, MacVLanMode mode) |
void | moveInterface (const std::string &ifname) |
void | destroyInterface (const std::string &ifname) |
void | setUpInterface (const std::string &ifname) |
void | setDownInterface (const std::string &ifname) |
void | addInetAddr (const std::string &ifname, const InetAddr &addr) |
void | delInetAddr (const std::string &ifname, const InetAddr &addr) |
void | declareFile (const provision::File::Type type, const std::string &path, const int32_t flags, const int32_t mode) |
Provisioning. More... | |
const FileVector & | getFiles () const |
void | removeFile (const provision::File &item) |
void | declareMount (const std::string &source, const std::string &target, const std::string &type, const int64_t flags, const std::string &data) |
const MountVector & | getMounts () const |
void | removeMount (const provision::Mount &item) |
void | declareLink (const std::string &source, const std::string &target) |
const LinkVector & | getLinks () const |
void | removeLink (const provision::Link &item) |
void | addSubsystem (const std::string &name, const std::string &path) |
CGroups. More... | |
void | addCGroup (const std::string &subsys, const std::string &grpname, const std::vector< CGroupParam > &comm, const std::vector< CGroupParam > ¶ms) |
void | setEnv (const std::vector< std::pair< std::string, std::string >> &variables) |
Environment variables. More... | |
void | setCaps (const int caps) |
Linux capabilities. More... | |
void | setSystemProperty (const std::string &name, const std::string &value) |
System Property (sysctl) More... | |
void | setRlimit (const std::string &type, const uint64_t hard, const uint64_t soft) |
Rlimit. More... | |
void | setNamespaces (const int namespaces) |
Namespaces TODO Needed to implement application container. More... | |
void | setUser (const int uid, const int gid, const std::vector< int > additionalGids) |
UID/GIDS TODO Needed to implement application container. More... | |
void | addDevice (const std::string &path, const char type, const int64_t major, const int64_t minor, const std::string &permissions, const uint32_t fileMode, const uint32_t uid, const uint32_t gid) |
Device. More... | |
void | addHook (const std::string &type, const std::vector< std::string > &hook, const std::vector< std::pair< std::string, std::string >> &env) |
Hooks. More... | |
Private Types | |
typedef std::unique_lock < std::mutex > | Lock |
Private Member Functions | |
void | onWorkFileEvent (const std::string &name, const uint32_t mask) |
bool | onGuardReady (const cargo::ipc::PeerID, std::shared_ptr< api::Void > &, cargo::ipc::MethodResult::Pointer) |
Guards tells that it's ready to receive commands. More... | |
bool | onInitStopped (const cargo::ipc::PeerID, std::shared_ptr< api::ExitStatus > &data, cargo::ipc::MethodResult::Pointer) |
Guards tells that Init exited with some status. More... | |
Private Attributes | |
std::mutex | mStateMutex |
std::shared_ptr< ContainerConfig > | mConfig |
cargo::ipc::epoll::ThreadDispatcher | mDispatcher |
std::shared_ptr < cargo::ipc::Client > | mClient |
utils::Inotify | mInotify |
Container::Callback | mStartedCallback |
Container::Callback | mStoppedCallback |
|
inherited |
|
private |
|
stronginherited |
lxcpp::ContainerImpl::ContainerImpl | ( | const std::string & | name, |
const std::string & | rootPath, | ||
const std::string & | workPath | ||
) |
lxcpp::ContainerImpl::~ContainerImpl | ( | ) |
|
virtual |
Implements lxcpp::Container.
|
virtual |
Device.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Hooks.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
adds interface configration.
throws NetworkException if zoneif name already on list
Implements lxcpp::Container.
|
virtual |
CGroups.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Other.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Provisioning.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Network interfaces (runtime)
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Configuration.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
States.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
private |
Guards tells that it's ready to receive commands.
This is a method handler, not signal to avoid races.
|
private |
Guards tells that Init exited with some status.
Init could have been:
|
private |
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Linux capabilities.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Environment variables.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Namespaces TODO Needed to implement application container.
Implements lxcpp::Container.
|
virtual |
Rlimit.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
System Property (sysctl)
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
UID/GIDS TODO Needed to implement application container.
Implements lxcpp::Container.
|
virtual |
Execution actions.
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
virtual |
Implements lxcpp::Container.
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |