diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-11-06 16:28:10 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@gmail.com> | 2018-11-07 09:45:34 -0500 |
commit | 3bacacce94089c4104cea0fff0f2945c22fc4813 (patch) | |
tree | b24e07f397ba6d1af1082d30f7afe3d4c0daab30 /libpod | |
parent | 9150d69087aed8f52b169eaf556159cc8b1d26d3 (diff) | |
download | podman-3bacacce94089c4104cea0fff0f2945c22fc4813.tar.gz podman-3bacacce94089c4104cea0fff0f2945c22fc4813.tar.bz2 podman-3bacacce94089c4104cea0fff0f2945c22fc4813.zip |
Remove conmon cgroup before pod cgroup for cgroupfs
For pods using cgroupfs, we were seeing some error messages in CI
from an inability to remove the pod CGroup, which was traced down
to the conmon cgroup still being present as a child. Try to
remove these error messages and ensure successful CGroup deletion
by removing the conmon CGroup first, then the pod cgroup.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime_pod_linux.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go index eb3d471dd..3d6fad52f 100644 --- a/libpod/runtime_pod_linux.go +++ b/libpod/runtime_pod_linux.go @@ -265,15 +265,26 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool) } case CgroupfsCgroupsManager: // Delete the cgroupfs cgroup + // Make sure the conmon cgroup is deleted first + // Since the pod is almost gone, don't bother failing + // hard - instead, just log errors. v1CGroups := GetV1CGroups(getExcludedCGroups()) + conmonCgroupPath := filepath.Join(p.state.CgroupPath, "conmon") + conmonCgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(conmonCgroupPath)) + if err != nil && err != cgroups.ErrCgroupDeleted { + return err + } + if err == nil { + if err := conmonCgroup.Delete(); err != nil { + logrus.Errorf("Error deleting pod %s conmon cgroup %s: %v", p.ID(), conmonCgroupPath, err) + } + } cgroup, err := cgroups.Load(v1CGroups, cgroups.StaticPath(p.state.CgroupPath)) if err != nil && err != cgroups.ErrCgroupDeleted { return err - } else if err == nil { + } + if err == nil { if err := cgroup.Delete(); err != nil { - // The pod is already almost gone. - // No point in hard-failing if we fail - // this bit of cleanup. logrus.Errorf("Error deleting pod %s cgroup %s: %v", p.ID(), p.state.CgroupPath, err) } } |