From 9d7b5947b9ff661433c4bedc018f5368830abbe6 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 21 Apr 2020 14:27:21 -0400 Subject: Fix handling of CGroupsParent and CGroupsMode Signed-off-by: Daniel J Walsh --- cmd/podman/common/create.go | 2 +- cmd/podman/common/create_opts.go | 2 +- cmd/podman/common/specgen.go | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index f256d9677..f4c7059d1 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -55,7 +55,7 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { "cgroup namespace to use", ) createFlags.StringVar( - &cf.CGroups, + &cf.CGroupsMode, "cgroups", containerConfig.Cgroups(), `control container cgroup configuration ("enabled"|"disabled"|"no-conmon")`, ) diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 9d12e4b26..37fe01460 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -11,7 +11,7 @@ type ContainerCLIOpts struct { CapAdd []string CapDrop []string CGroupsNS string - CGroups string + CGroupsMode string CGroupParent string CIDFile string ConmonPIDFile string diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 12fd16551..e8e889e66 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -124,7 +124,7 @@ func getPidsLimits(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string) pids.Limit = c.PIDsLimit hasLimits = true } - if c.CGroups == "disabled" && c.PIDsLimit > 0 { + if c.CGroupsMode == "disabled" && c.PIDsLimit > 0 { s.ResourceLimits.Pids.Limit = -1 } if !hasLimits { @@ -473,12 +473,11 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string if ld := c.LogDriver; len(ld) > 0 { s.LogConfiguration.Driver = ld } + s.CgroupParent = c.CGroupParent + s.CgroupsMode = c.CGroupsMode // TODO WTF //cgroup := &cc.CgroupConfig{ - // Cgroups: c.String("cgroups"), // Cgroupns: c.String("cgroupns"), - // CgroupParent: c.String("cgroup-parent"), - // CgroupMode: cgroupMode, //} // //userns := &cc.UserConfig{ -- cgit v1.2.3-54-g00ecf