Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcontainer: export and add new methods to allow cgroups manipulation #2177

Merged

Conversation

devimc
Copy link
Contributor

@devimc devimc commented Dec 6, 2019

libcontainer: export createCgroupConfig

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.

libcontainer: add method to get cgroup config from cgroup Manager

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 #2176

@devimc
Copy link
Contributor Author

devimc commented Dec 13, 2019

ping @mrunalp

@@ -46,6 +46,9 @@ type Manager interface {

// Sets the cgroup as configured.
Set(container *configs.Config) error

// Gets the cgroup as configured.
GetCgroups() (*configs.Cgroup, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @devimc:

  1. nit: s/splications/applications on your commit message.
  2. 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!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks

@devimc devimc force-pushed the topic/libcontainer/kata-containers branch from ed50637 to 7897de1 Compare December 17, 2019 22:45
Julio Montes 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>
@devimc devimc force-pushed the topic/libcontainer/kata-containers branch from 7897de1 to 8ddd892 Compare December 17, 2019 22:46
@mrunalp
Copy link
Contributor

mrunalp commented Jan 2, 2020

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Member

crosbymichael commented Jan 2, 2020

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit 2b52db7 into opencontainers:master Jan 2, 2020
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcontainer: export and add new methods to allow cgroups manipulation
4 participants