Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Plugin library that create a DIAG logging pipe for a container. More...
#include <EthanLogPlugin.h>
Public Member Functions | |
EthanLogPlugin (const std::shared_ptr< IDobbyEnv > &env, const std::shared_ptr< IDobbyUtils > &utils) | |
std::string | name () const final |
Boilerplate that just returns the name of the hook. More... | |
unsigned | hookHints () const final |
Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks. More... | |
bool | postConstruction (const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData) final |
We hook the postConstruction point to create a logging pipe for the container which we then given to the init process of the container. More... | |
bool | preStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) final |
We hook the preStart point so we can tell the EthanLog code the base pid of the container. More... | |
Public Member Functions inherited from PluginBase | |
virtual bool | postStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container is started and the init process is now running. More... | |
virtual bool | postStop (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called after the container has stopped. More... | |
virtual bool | preDestruction (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container. More... | |
Private Member Functions | |
unsigned | parseLogLevels (const Json::Value &jsonArray) const |
Parses the supplied json array and returns a bitmask of the log levels. More... | |
Private Attributes | |
const std::string | mName |
const std::shared_ptr< IDobbyUtils > | mUtilities |
const std::shared_ptr< EthanLogLoop > | mLogLoop |
const unsigned | mDefaultLogLevelsMask |
int | mDevNullFd |
Additional Inherited Members | |
Public Types inherited from IDobbyPlugin | |
enum | HintFlags : unsigned { PostConstructionSync = (1 << 0) , PreStartSync = (1 << 1) , PostStartSync = (1 << 2) , PostStopSync = (1 << 3) , PreDestructionSync = (1 << 4) , PostConstructionAsync = (1 << 16) , PreStartAsync = (1 << 17) , PostStartAsync = (1 << 18) , PostStopAsync = (1 << 19) , PreDestructionAsync = (1 << 20) } |
Bit flags that should be returned by hookHints. More... | |
Plugin library that create a DIAG logging pipe for a container.
This plugin uses the IPC / DBUS fusion interface to request a new logging pipe from APP_Process (the AI AppLogger component). The write end of the pipe file descriptor is then inserted into the container and an environment variable is set with the number of the fd.
|
finalvirtual |
Indicates which hook points we want and whether to run the asynchronously or synchronously with the other hooks.
For this plugin everything is done in the postConstruction and preStart hooks and synchronously with any other plugins / hooks.
Implements IDobbyPlugin.
|
finalvirtual |
Boilerplate that just returns the name of the hook.
This string needs to match the name specified in the container spec json.
Implements IDobbyPlugin.
|
private |
Parses the supplied json array and returns a bitmask of the log levels.
The json object should be an array of strings which may contain any of the following strings
"default", "fatal", "error", "warning", "info", "debug", "milestone"
[in] | jsonArray | The json array object |
|
finalvirtual |
We hook the postConstruction point to create a logging pipe for the container which we then given to the init process of the container.
The json for the plugin data should be formatted like so
{ "name" : "SomeApp", "loglevels" : [ "fatal", "milestone", "info", "debug" ], "rateLimit" { "rate": 1234, "burstSize": 12345 } }
[in] | id | The id of the container |
[in] | startupState | The startup state of the container (ignored) |
[in] | rootfsPath | The absolute path to the rootfs of the container |
[in] | jsonData | The json data from the spec file (ignored) |
Reimplemented from PluginBase.
|
finalvirtual |
We hook the preStart point so we can tell the EthanLog code the base pid of the container.
We need this because the logging library reports it's own pid and that is relative to it's own pid namespace.
[in] | id | The id of the container |
[in] | pid | The pid of the init process inside the container |
[in] | rootfsPath | The absolute path to the rootfs of the container |
[in] | jsonData | The json data from the spec file (ignored) |
Reimplemented from PluginBase.