RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
To support additional functionality, Dobby allows developers to create C++ plugins that can execute code at various stages of a containers lifecycle such as before creation, during startup or at container shutdown. This could be used to map devices, configure networking/iptables or setup displays. Dobby uses a mixture of custom hook-points and OCI hooks (https://github.com/opencontainers/runtime-spec/blob/master/config.md#posix-platform-hooks) to support this.
Plugins are installed in /usr/lib/plugins/dobby by default, although this can be changed at compile-time as necessary.
By default, Dobby builds the following plugins:
To enable/disable plugins, add the -DPLUGIN_XYZ=ON/OFF compile flag when building Dobby.
The following table shows the various hook points that a developer can use in their plugins:
Proposed Container Hooks Required for Plugin Support | |||||
---|---|---|---|---|---|
Diagram Ref # | Name | Execution Namespace | Path Resolution Namespace | When | Responsibility |
4 | postInstallation | host | host | After the OCI bundle has been downloaded to the client STB, before the runtime’s create operation is called. Only run once per container - if the container is stopped and restarted this hook does not run again Can modify the container config file | Dobby |
5 | preCreation | host | host | After postInstallation, but before the create operation is called. Is run every time the container is launched. Can modify the container config file | Dobby |
9 | createRuntime | host | host | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. This hook, and subsequent hooks, can not modify the container config | OCI Runtime (crun) |
10 | createContainer | container | host | During the create operation, after the runtime environment has been created and before the pivot root or any equivalent operation. | OCI Runtime (crun) |
12 | startContainer | container | container | After the start operation is called but before the user-specified program command is executed. | OCI Runtime (crun) |
14 | postStart | host | host | After the user-specified process is executed but before the start operation returns. | OCI Runtime (crun) |
16 | postHalt | host | host | When a SIGTERM signal is received from the container. Before the delete operation is called | Dobby |
20 | postStop | host | host | After the container is deleted but before the delete operation returns. | OCI Runtime (crun) |
To allow Dobby plugins to be run by the OCI hooks, the DobbyPluginLauncher executable is used. This loads the plugins from the plugin directory and runs the specified hook point. This is all configured and run automatically and should not need to be modified.
Dobby plugins are written in C++ and authored against the IDobbyRDKPlugin interface: https://github.com/rdkcentral/Dobby/blob/master/pluginLauncher/lib/include/IDobbyRdkPlugin.h. A plugin should declare which hook points it uses by setting the relevant flags, and then override the relevant methods in the interface for those hook points. It only needs to implement methods that it requires - any methods not implemented are skipped.
Every plugin has full read access to the containers config, and the postInstallation and preCreation hooks may also make modifications to the container configuration. After those two hooks, the container config is persisted to disk and can no longer be modified.
A sample plugin - TestRDKPlugin - is available which executes a print statement at each hook point and can be used as an example for further development. All plugins also include a README file which documents their usage.