25 #ifndef COMMON_LXC_ZONE_HPP
26 #define COMMON_LXC_ZONE_HPP
30 #include <sys/types.h>
44 typedef std::function<int()>
Call;
62 LxcZone(
const std::string& lxcPath,
const std::string& zoneName);
105 bool create(
const std::string& templatePath,
const char*
const* argv);
116 bool start(
const char*
const* argv);
171 const std::int32_t flags,
172 const std::int32_t mode,
186 #endif // COMMON_LXC_ZONE_HPP
bool isDefined()
Is zone defined (created)?
Definition: zone.cpp:132
State getState()
Get zone state.
Definition: zone.cpp:137
std::string getName() const
Get zone name.
Definition: zone.cpp:115
A class wrapping lxc container.
Definition: zone.hpp:42
bool reboot()
Reboot zone.
Definition: zone.cpp:249
lxc_container * mLxcContainer
Definition: zone.hpp:176
std::string getConfigItem(const std::string &key)
Get item from lxc config file.
Definition: zone.cpp:120
~LxcZone()
Definition: zone.cpp:110
bool createFile(const std::string &path, const std::int32_t flags, const std::int32_t mode, int *fdPtr)
Create a file inside the zone and return it's file descriptor.
Definition: zone.cpp:380
bool freeze()
Freeze (pause/lock) zone.
Definition: zone.cpp:305
bool runInZone(Call &call)
Attach to the Zone and run the call.
Definition: zone.cpp:354
pid_t getInitPid() const
Get pid of init process.
Definition: zone.cpp:332
bool stop()
Immediate stop the zone It kills all processes within this zone.
Definition: zone.cpp:240
bool destroy()
Destroy zone.
Definition: zone.cpp:179
bool shutdown(int timeout)
Gracefully shutdown zone.
Definition: zone.cpp:258
LxcZone(const std::string &lxcPath, const std::string &zoneName)
LxcZone constructor.
Definition: zone.cpp:99
std::function< int()> Call
Definition: zone.hpp:44
std::string key(const Arg1 &a1, const Args &...args)
Concatenates all parameters into one std::string.
Definition: kvstore-visitor-utils.hpp:60
static std::string toString(State state)
String representation of state.
Definition: zone.cpp:83
bool start(const char *const *argv)
Start zone.
Definition: zone.cpp:188
bool setRunLevel(int runLevel)
Definition: zone.cpp:337
LxcZone & operator=(const LxcZone &)=delete
bool waitForState(State state, int timeout)
Wait till zone is in specified state.
Definition: zone.cpp:323
bool create(const std::string &templatePath, const char *const *argv)
Create zone.
Definition: zone.cpp:143
void refresh()
Definition: zone.cpp:345
bool unfreeze()
Unfreeze zone.
Definition: zone.cpp:314
State
Definition: zone.hpp:46