Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Takes a JSON formatted OCI bundle configuration file in the constructor, parses it and extracts the relevant fields. More...
#include <DobbyBundleConfig.h>
Public Member Functions | |
DobbyBundleConfig (const std::shared_ptr< IDobbyUtils > &utils, const std::shared_ptr< const IDobbySettings > &settings, const ContainerId &id, const std::string &bundlePath) | |
Constructor that parses an OCI bundle's config file to be used by Dobby. Plugins under 'rdkPlugins' and 'legacyPlugins' are parsed if found (OCI bundle*). | |
bool | isValid () const override |
Getters used for plugins. | |
uid_t | userId () const override |
gid_t | groupId () const override |
IDobbyIPCUtils::BusType | systemDbus () const override |
IDobbyIPCUtils::BusType | sessionDbus () const override |
IDobbyIPCUtils::BusType | debugDbus () const override |
bool | consoleDisabled () const override |
ssize_t | consoleLimit () const override |
const std::string & | consolePath () const override |
bool | restartOnCrash () const override |
const std::string & | rootfsPath () const override |
std::shared_ptr< rt_dobby_schema > | config () const override |
const std::map< std::string, Json::Value > & | rdkPlugins () const override |
![]() | |
bool | addMount (const std::string &source, const std::string &target, const std::string &fsType, unsigned long mountFlags, const std::list< std::string > &mountOptions) |
Public api to allow for adding additional mounts. | |
bool | addEnvironmentVar (const std::string &envVar) |
Public api to allow for adding additional env variables. | |
bool | changeProcessArgs (const std::string &command) |
bool | addWesterosMount (const std::string &socketPath) |
bool | writeConfigJson (const std::string &filePath) const |
Writes bundle config string to a file. | |
const std::string | configJson () const |
Get OCI bundle config json as string. | |
void | printCommand () const |
bool | enableSTrace (const std::string &logsDir) |
Enables strace for the container. | |
void | setApparmorProfile (const std::string &profileName) |
Set apparmor profile in config. | |
void | setPidsLimit (int limit) |
Set cgroup pids limit. | |
Private Member Functions | |
bool | parseOCIConfig (const std::string &bundlePath) |
Parses the bundle config's contents that are needed by plugins. | |
bool | constructConfig (const ContainerId &id, const std::string &bundlePath) |
Creates config object. | |
Private Attributes | |
const std::shared_ptr< IDobbyUtils > | mUtilities |
const std::shared_ptr< const IDobbySettings > | mSettings |
bool | mValid |
Json::Value | mConfig |
std::shared_ptr< rt_dobby_schema > | mConf |
uid_t | mUserId |
gid_t | mGroupId |
bool | mRestartOnCrash |
IDobbyIPCUtils::BusType | mSystemDbus |
IDobbyIPCUtils::BusType | mSessionDbus |
IDobbyIPCUtils::BusType | mDebugDbus |
bool | mConsoleDisabled |
std::string | mConsolePath |
ssize_t | mConsoleLimit |
std::map< std::string, Json::Value > | mRdkPlugins |
std::string | mRootfsPath |
Additional Inherited Members | |
![]() | |
enum class | NetworkType { None , Nat , Open } |
Network type used for Network plugin. | |
typedef struct DobbyConfig::_LoopMount | LoopMount |
Loopmount struct used for Storage plugin. | |
![]() | |
bool | writeConfigJsonImpl (const std::string &filePath) const |
bool | updateBundleConfig (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins. | |
bool | setHostnameToContainerId (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
Sets the container hostname to the container ID. | |
bool | convertToCompliant (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins. | |
bool | isApparmorProfileLoaded (const char *profile) const |
Check if apparmor profile is loaded. | |
![]() | |
static std::list< DevNode > | scanDevNodes (const std::list< std::string > &devNodes) |
Takes a list of glob patterns corresponding to dev node paths and returns a list of structs with their details. | |
![]() | |
std::mutex | mLock |
Takes a JSON formatted OCI bundle configuration file in the constructor, parses it and extracts the relevant fields.
It's main purpose is to read an extended OCI bundle config with plugins so it can be converted into an OCI compliant bundle.
DobbyBundleConfig::DobbyBundleConfig | ( | const std::shared_ptr< IDobbyUtils > & | utils, |
const std::shared_ptr< const IDobbySettings > & | settings, | ||
const ContainerId & | id, | ||
const std::string & | bundlePath | ||
) |
Constructor that parses an OCI bundle's config file to be used by Dobby. Plugins under 'rdkPlugins' and 'legacyPlugins' are parsed if found (OCI bundle*).
Public methods
[in] | utils | The daemon utils object. |
[in] | settings | Dobby settings object. |
[in] | id | Container ID. |
[in] | bundlePath | Path to OCI bundle. |
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
private |
Creates config object.
This method parses OCI config and creates dobby config based on that. This was an old constructor for DobbyBundleConfig, but we need to be able to recover in case config gets damaged.
[in] | id | Container ID. |
[in] | bundlePath | Path to the container's OCI bundle |
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Getters used for plugins.
Implements DobbyConfig.
|
private |
Parses the bundle config's contents that are needed by plugins.
Private methods
The function is atomic, therefore if it returns true you can guarantee it stuck and will be set for the lifetime of the function.
[in] | bundlePath | path to the container's OCI bundle |
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
overridevirtual |
Implements DobbyConfig.
|
private |
Member variables