libcontainer: export and add new methods to allow cgroups manipulation#2177
Merged
crosbymichael merged 2 commits intoopencontainers:masterfrom Jan 2, 2020
Merged
Conversation
70ed2ca to
ed50637
Compare
Contributor
Author
|
ping @mrunalp |
egernst
reviewed
Dec 13, 2019
| Set(container *configs.Config) error | ||
|
|
||
| // Gets the cgroup as configured. | ||
| GetCgroups() (*configs.Cgroup, error) |
Contributor
There was a problem hiding this comment.
Hey @devimc:
- nit: s/splications/applications on your commit message.
- Can you better explain the intended use case, highlighting why this is needed? Specific to the Kata case (in both v2-shim and CLI based configurations), what do we do with the cgroup config? Do we need to store a copy of the information, or can it be obtained as needed later? It just isn't clear to me. thx!
ed50637 to
7897de1
Compare
added 2 commits
December 17, 2019 22:46
A `config.Cgroups` object is required to manipulate cgroups v1 and v2 using libcontainer. Export `createCgroupConfig` to allow API users to create `config.Cgroups` objects using directly libcontainer API. Signed-off-by: Julio Montes <julio.montes@intel.com>
`configs.Cgroup` contains the configuration used to create cgroups. This configuration must be saved to disk, since it's required to restore the cgroup manager that was used to create the cgroups. Add method to get cgroup configuration from cgroup Manager to allow API users save it to disk and restore a cgroup manager later. fixes opencontainers#2176 Signed-off-by: Julio Montes <julio.montes@intel.com>
7897de1 to
8ddd892
Compare
Contributor
1 similar comment
Member
AkihiroSuda
added a commit
to AkihiroSuda/runc
that referenced
this pull request
Jan 14, 2020
A new method was added to the cgroup interface when opencontainers#2177 was merged. After opencontainers#2177 got merged, opencontainers#2169 was merged without rebase (sorry!) and compilation was failing: libcontainer/cgroups/fs2/fs2.go:208:22: container.Cgroup undefined (type *configs.Config has no field or method Cgroup) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
adrianreber
pushed a commit
to adrianreber/runc
that referenced
this pull request
Feb 10, 2020
A new method was added to the cgroup interface when opencontainers#2177 was merged. After opencontainers#2177 got merged, opencontainers#2169 was merged without rebase (sorry!) and compilation was failing: libcontainer/cgroups/fs2/fs2.go:208:22: container.Cgroup undefined (type *configs.Config has no field or method Cgroup) Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libcontainer: export createCgroupConfig
A
config.Cgroupsobject is required to manipulate cgroups v1 and v2 usinglibcontainer.
Export
createCgroupConfigto allow API users to createconfig.Cgroupsobjects using directly libcontainer API.
libcontainer: add method to get cgroup config from cgroup Manager
configs.Cgroupcontains the configuration used to create cgroups. Thisconfiguration must be saved to disk, since it's required to restore the
cgroup manager that was used to create the cgroups.
Add method to get cgroup configuration from cgroup Manager to allow API users
save it to disk and restore a cgroup manager later.
fixes #2176