diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-08-13 15:39:11 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-15 18:07:04 +0000 |
commit | 0998808a752a8a7ae43f2630023b22c1b3de47a4 (patch) | |
tree | 7307d450f56898f5779c324b8c75efd2b40060f0 /libpod/oci_linux.go | |
parent | ad7d46957156a2ab9ae5bae6b4e337d941a3b971 (diff) | |
download | podman-0998808a752a8a7ae43f2630023b22c1b3de47a4.tar.gz podman-0998808a752a8a7ae43f2630023b22c1b3de47a4.tar.bz2 podman-0998808a752a8a7ae43f2630023b22c1b3de47a4.zip |
Create pod CGroups when using the systemd cgroup driver
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #1266
Approved by: baude
Diffstat (limited to 'libpod/oci_linux.go')
-rw-r--r-- | libpod/oci_linux.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index bdf859d7d..dacc92c62 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -24,8 +24,14 @@ func (r *OCIRuntime) moveConmonToCgroup(ctr *Container, cgroupParent string, cmd if r.cgroupManager == SystemdCgroupsManager { 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 { + realCgroupParent := cgroupParent + splitParent := strings.Split(cgroupParent, "/") + if strings.HasSuffix(cgroupParent, ".slice") && len(splitParent) > 1 { + realCgroupParent = splitParent[len(splitParent)-1] + } + + logrus.Infof("Running conmon under slice %s and unitName %s", realCgroupParent, unitName) + if err := utils.RunUnderSystemdScope(cmd.Process.Pid, realCgroupParent, unitName); err != nil { logrus.Warnf("Failed to add conmon to systemd sandbox cgroup: %v", err) } } else { |