drivers/exec: test all cgroups are destroyed

This commit is contained in:
Mahmood Ali
2019-12-11 10:28:41 -05:00
parent 8babbf4f1b
commit 2f4b9da61a
2 changed files with 99 additions and 0 deletions

View File

@@ -747,6 +747,22 @@ func configureBasicCgroups(cfg *lconfigs.Config) error {
return nil
}
func getCgroupPathHelper(subsystem, cgroup string) (string, error) {
mnt, root, err := cgroups.FindCgroupMountpointAndRoot("", subsystem)
if err != nil {
return "", err
}
// This is needed for nested containers, because in /proc/self/cgroup we
// see paths from host, which don't exist in container.
relCgroup, err := filepath.Rel(root, cgroup)
if err != nil {
return "", err
}
return filepath.Join(mnt, relCgroup), nil
}
func newLibcontainerConfig(command *ExecCommand) (*lconfigs.Config, error) {
cfg := &lconfigs.Config{
Cgroups: &lconfigs.Cgroup{