diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-05-07 14:44:38 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-11 14:43:57 +0000 |
commit | b70f6cc04a831478b2c81094b6bfe80bfed6a687 (patch) | |
tree | 5e0329fcf0ae5cfd0e32cc8d26a28b9cea3da58f /libpod/oci.go | |
parent | 853c5c41f1a0f65815674cce0777a20de24c8309 (diff) | |
download | podman-b70f6cc04a831478b2c81094b6bfe80bfed6a687.tar.gz podman-b70f6cc04a831478b2c81094b6bfe80bfed6a687.tar.bz2 podman-b70f6cc04a831478b2c81094b6bfe80bfed6a687.zip |
Place Conmon and Container in separate CGroups
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.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libpod/oci.go b/libpod/oci.go index 3b24f2c23..4dbf5526d 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -328,19 +328,15 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string) (er logrus.Warnf("Failed to add conmon to systemd sandbox cgroup: %v", err) } } else { - cgroupPath, err := ctr.CGroupPath() + cgroupPath := filepath.Join(ctr.config.CgroupParent, fmt.Sprintf("libpod-%s", ctr.ID()), "conmon") + control, err := cgroups.New(cgroups.V1, cgroups.StaticPath(cgroupPath), &spec.LinuxResources{}) if err != nil { - logrus.Errorf("Failed to generate CGroup path for conmon: %v", err) + logrus.Warnf("Failed to add conmon to cgroupfs sandbox cgroup: %v", err) } else { - control, err := cgroups.New(cgroups.V1, cgroups.StaticPath(cgroupPath), &spec.LinuxResources{}) - if err != nil { + // 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) - } 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) - } } } } |