Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
oci: Follow the OCI spec for cgroup paths
Browse files Browse the repository at this point in the history
Getting an absolute path while not having a cgroup mount
from the OCI spec is a valid case. In that case the path
should be interpreted as a relative one to the system
cgroup mount point.

Fixes #552

Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz committed Sep 14, 2017
1 parent 876e3fc commit 159bd4e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,9 @@ func processCgroupsPathForResource(ociSpec oci.CompatOCISpec, resource string, i
}

if !cgroupMountFound {
if isPod {
return "", fmt.Errorf("cgroupsPath %q is absolute, cgroup mount MUST exist",
ociSpec.Linux.CgroupsPath)
}

// In case of container (CRI-O), if the mount point is not
// provided, we assume this is a relative path.
// According to the OCI spec, an absolute path should be
// interpreted as relative to the system cgroup mount point
// when there is no cgroup mount point.
return filepath.Join(cgroupsDirPath, resource, ociSpec.Linux.CgroupsPath), nil
}

Expand Down

0 comments on commit 159bd4e

Please sign in to comment.