diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 4 | ||||
-rw-r--r-- | libpod/oci.go | 2 | ||||
-rw-r--r-- | libpod/options.go | 5 | ||||
-rw-r--r-- | libpod/runtime.go | 2 |
4 files changed, 10 insertions, 3 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 1098dc66c..816e7bd31 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1133,7 +1133,9 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { // When runc is set to use Systemd as a cgroup manager, it // expects cgroups to be passed as follows: // slice:prefix:name - g.SetLinuxCgroupsPath(path.Base(c.config.CgroupParent) + ":" + "libpod" + ":" + c.ID()) + systemdCgroups := fmt.Sprintf("%s:libpod:%s", path.Base(c.config.CgroupParent), c.ID()) + logrus.Debugf("Setting CGroups for container %s to %s", c.ID(), systemdCgroups) + g.SetLinuxCgroupsPath(systemdCgroups) } else { cgroupPath, err := c.CGroupPath() if err != nil { diff --git a/libpod/oci.go b/libpod/oci.go index e1df807cd..3b24f2c23 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -321,7 +321,7 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string) (er // Move conmon to specified cgroup if r.cgroupManager == SystemdCgroupsManager { - unitName := createUnitName("libpod", ctr.ID()) + unitName := createUnitName("libpod-conmon", ctr.ID()) logrus.Infof("Running conmon under slice %s and unitName %s", cgroupParent, unitName) if err = utils.RunUnderSystemdScope(cmd.Process.Pid, cgroupParent, unitName); err != nil { diff --git a/libpod/options.go b/libpod/options.go index 2b3ad2eb4..90b376668 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -152,6 +152,11 @@ func WithCgroupManager(manager string) RuntimeOption { return ErrRuntimeFinalized } + if manager != CgroupfsCgroupsManager && manager != SystemdCgroupsManager { + return errors.Wrapf(ErrInvalidArg, "CGroup manager must be one of %s and %s", + CgroupfsCgroupsManager, SystemdCgroupsManager) + } + rt.config.CgroupManager = manager return nil diff --git a/libpod/runtime.go b/libpod/runtime.go index dde81a59d..bf484429e 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -158,7 +158,7 @@ var ( ConmonEnvVars: []string{ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", }, - CgroupManager: "cgroupfs", + CgroupManager: CgroupfsCgroupsManager, HooksDir: hooks.DefaultHooksDir, StaticDir: filepath.Join(storage.DefaultStoreOptions.GraphRoot, "libpod"), TmpDir: "/var/run/libpod", |