Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Plugin used to setup the ION cgroup controller for the container. More...
#include <IonMemoryPlugin.h>
Public Member Functions | |
IonMemoryPlugin (std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath) | |
std::string | name () const override |
Should return the name of the plugin. More... | |
unsigned | hookHints () const override |
Set the bit flags for which hooks we're going to use. | |
bool | createRuntime () override |
OCI Hook - Run in host namespace. We use this point to create a cgroup and put the containered process into it. More... | |
bool | postStop () override |
Poststop hook, we use this point to remove the cgroup directory created in the pre start phase. More... | |
Public Member Functions inherited from RdkPluginBase | |
virtual bool | postInstallation () |
virtual bool | preCreation () |
virtual bool | createContainer () |
virtual bool | postStart () |
virtual bool | postHalt () |
std::vector< std::string > | getDependencies () const override |
Should return the names of the plugins this plugin depends on. More... | |
Private Member Functions | |
std::string | findIonCGroupMountPoint () const |
Attempts to get the mount points of the ION cgroup filesystem. More... | |
bool | setupContainerIonLimits (const std::string &cGroupDirPath, pid_t containerPid, const std::map< std::string, uint64_t > &heapLimits, uint64_t defaultLimit) |
Creates a ion cgroup for the container and moves the container into it. More... | |
Private Attributes | |
const std::string | mName |
std::shared_ptr< rt_dobby_schema > | mContainerConfig |
const std::shared_ptr< DobbyRdkPluginUtils > | mUtils |
const std::string | mRootfsPath |
bool | mValid |
const rt_defs_plugins_ion_memory_data * | mPluginData |
Additional Inherited Members | |
Public Types inherited from IDobbyRdkPlugin | |
enum | HintFlags : unsigned { PostInstallationFlag = (1 << 0) , PreCreationFlag = (1 << 1) , CreateRuntimeFlag = (1 << 2) , CreateContainerFlag = (1 << 3) , PostStartFlag = (1 << 5) , PostHaltFlag = (1 << 6) , PostStopFlag = (1 << 7) , Unknown = 0 } |
Bit flags that should be returned by hookHints. More... | |
Plugin used to setup the ION cgroup controller for the container.
ION is the raw memory allocator from Android, it is used on RDK platforms by some vendors to allocate memory buffers for the following systems:
|
overridevirtual |
OCI Hook - Run in host namespace. We use this point to create a cgroup and put the containered process into it.
We also set any limits from the plugin JSON data provided.
The cgroup is given the same name as the container.
Reimplemented from RdkPluginBase.
|
private |
Attempts to get the mount points of the ION cgroup filesystem.
This scans the mount table looking for the cgroups mounts. This is typically the name of the cgroup prefixed with "/sys/fs/cgroup"
|
inlineoverridevirtual |
Should return the name of the plugin.
Implements IDobbyRdkPlugin.
|
overridevirtual |
Poststop hook, we use this point to remove the cgroup directory created in the pre start phase.
The directory will have the same name as the container id.
[in] | id | The id of the container. |
[in] | config | The container config. |
[in] | rootfs | The path to the container rootfs. |
Reimplemented from RdkPluginBase.
|
private |
Creates a ion cgroup for the container and moves the container into it.
The amount of memory to assign is retrieved from the config object.
The cgroup is given the same name as the container.
[in] | id | The id of the container. |
[in] | containerPid | The pid of the process in the container. |
[in] | heapLimits | Map of the heap name to its limits. |
[in] | defaultLimit | The default limit to set on a heap if not in the heapLimits map. |