Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
IonMemoryPlugin.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2021 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: IonMemoryPlugin.h
21 *
22 */
23#ifndef IONMEMORYPLUGIN_H
24#define IONMEMORYPLUGIN_H
25
26#include <RdkPluginBase.h>
27#include <map>
28
39class IonMemoryPlugin final : public RdkPluginBase
40{
41public:
42 IonMemoryPlugin(std::shared_ptr<rt_dobby_schema> &containerConfig,
43 const std::shared_ptr<DobbyRdkPluginUtils> &utils,
44 const std::string &rootfsPath);
45
46public:
47 inline std::string name() const override
48 {
49 return mName;
50 };
51
52 unsigned hookHints() const override;
53
54public:
55 bool createRuntime() override;
56 bool postStop() override;
57
58private:
59 std::string findIonCGroupMountPoint() const;
60 bool setupContainerIonLimits(const std::string &cGroupDirPath,
61 pid_t containerPid,
62 const std::map<std::string, uint64_t> &heapLimits,
63 uint64_t defaultLimit);
64
65private:
66 const std::string mName;
67 std::shared_ptr<rt_dobby_schema> mContainerConfig;
68 const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
69 const std::string mRootfsPath;
70
71 bool mValid;
72 const rt_defs_plugins_ion_memory_data *mPluginData;
73};
74
75#endif // !defined(IONMEMORYPLUGIN_H)
Plugin used to setup the ION cgroup controller for the container.
Definition IonMemoryPlugin.h:40
unsigned hookHints() const override
Set the bit flags for which hooks we're going to use.
Definition IonMemoryPlugin.cpp:65
std::string findIonCGroupMountPoint() const
Attempts to get the mount points of the ION cgroup filesystem.
Definition IonMemoryPlugin.cpp:187
bool createRuntime() override
OCI Hook - Run in host namespace. We use this point to create a cgroup and put the containered proces...
Definition IonMemoryPlugin.cpp:84
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.
Definition IonMemoryPlugin.cpp:254
std::string name() const override
Should return the name of the plugin.
Definition IonMemoryPlugin.h:47
bool postStop() override
Poststop hook, we use this point to remove the cgroup directory created in the pre start phase.
Definition IonMemoryPlugin.cpp:143
Basic object that provides the default overrides for a plugin.
Definition RdkPluginBase.h:34