summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-21 11:28:16 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-11 14:43:57 +0000
commitdf83d361e4fe3c1fc1939b096cb21aa2e7ec3d74 (patch)
tree3f4bb6dba3763a5895135fadecc005eeb0ea96ca /libpod/oci.go
parentfee9ec18584bcc31ce4889bdbda2fc2a829eaf5f (diff)
downloadpodman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.tar.gz
podman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.tar.bz2
podman-df83d361e4fe3c1fc1939b096cb21aa2e7ec3d74.zip
Major fixes to systemd cgroup handling
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #507 Approved by: baude
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index a07aa8d86..e1df807cd 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -321,19 +321,26 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string) (er
// Move conmon to specified cgroup
if r.cgroupManager == SystemdCgroupsManager {
- logrus.Infof("Running conmon under slice %s and unitName %s", cgroupParent, createUnitName("libpod-conmon", ctr.ID()))
- if err = utils.RunUnderSystemdScope(cmd.Process.Pid, cgroupParent, createUnitName("libpod-conmon", ctr.ID())); err != nil {
+ unitName := createUnitName("libpod", 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 {
logrus.Warnf("Failed to add conmon to systemd sandbox cgroup: %v", err)
}
} else {
- control, err := cgroups.New(cgroups.V1, cgroups.StaticPath(filepath.Join(cgroupParent, "/libpod-conmon-"+ctr.ID())), &spec.LinuxResources{})
+ cgroupPath, err := ctr.CGroupPath()
if err != nil {
- logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err)
+ logrus.Errorf("Failed to generate CGroup path for conmon: %v", err)
} else {
- // we need to remove this defer and delete the cgroup once conmon exits
- // maybe need a conmon monitor?
- if err := control.Add(cgroups.Process{Pid: cmd.Process.Pid}); err != nil {
+ control, err := cgroups.New(cgroups.V1, cgroups.StaticPath(cgroupPath), &spec.LinuxResources{})
+ if err != nil {
logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err)
+ } else {
+ // we need to remove this defer and delete the cgroup once conmon exits
+ // maybe need a conmon monitor?
+ if err := control.Add(cgroups.Process{Pid: cmd.Process.Pid}); err != nil {
+ logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err)
+ }
}
}
}