mirror of
https://github.com/containers/podman.git
synced 2025-06-03 03:07:56 +08:00
Merge pull request #13413 from giuseppe/pod-no-use-cgroups-if-disabled
libpod: pods do not use cgroups if --cgroups=disabled
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package libpod
|
||||
@ -59,6 +60,7 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option
|
||||
pod.valid = true
|
||||
|
||||
// Check Cgroup parent sanity, and set it if it was not set
|
||||
if r.config.Cgroups() != "disabled" {
|
||||
switch r.config.Engine.CgroupManager {
|
||||
case config.CgroupfsCgroupsManager:
|
||||
canUseCgroup := !rootless.IsRootless() || isRootlessCgroupSet(pod.config.CgroupParent)
|
||||
@ -104,6 +106,7 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option
|
||||
default:
|
||||
return nil, errors.Wrapf(define.ErrInvalidArg, "unsupported Cgroup manager: %s - cannot validate cgroup parent", r.config.Engine.CgroupManager)
|
||||
}
|
||||
}
|
||||
|
||||
if pod.config.UsePodCgroup {
|
||||
logrus.Debugf("Got pod cgroup as %s", pod.state.CgroupPath)
|
||||
|
@ -562,6 +562,11 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
inspect = podmanTest.Podman([]string{"inspect", "--format", "{{ .HostConfig.Cgroups }}", result.OutputToString()})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect.OutputToString()).To(Equal("disabled"))
|
||||
|
||||
// Check we can also create a pod when cgroups=disabled
|
||||
result = podmanTest.Podman([]string{"pod", "create"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
})
|
||||
|
||||
It("podman containers.conf runtime", func() {
|
||||
|
Reference in New Issue
Block a user