Skip to content

Commit

Permalink
fs2: support legacy device spec (to pass CI)
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Dec 6, 2019
1 parent 88e8350 commit ec49f98
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions libcontainer/cgroups/fs2/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,23 @@ func canSkipEBPFError(cgroup *configs.Cgroup) bool {
}

func setDevices(dirPath string, cgroup *configs.Cgroup) error {
if cgroup.Resources.AllowAllDevices != nil {
// never set by OCI specconv
return errors.New("libcontainer AllowAllDevices is not supported, use Devices")
devices := cgroup.Devices
if allowAllDevices := cgroup.Resources.AllowAllDevices; allowAllDevices != nil {
// never set by OCI specconv, but *allowAllDevices=false is still used by the integration test
if *allowAllDevices == true {
return errors.New("libcontainer AllowAllDevices is not supported, use Devices")
}
for _, ad := range cgroup.Resources.AllowedDevices {
d := *ad
d.Allow = true
devices = append(devices, &d)
}
}
if len(cgroup.Resources.DeniedDevices) != 0 {
// never set by OCI specconv
return errors.New("libcontainer DeniedDevices is not supported, use Devices")
}
insts, license, err := devicefilter.DeviceFilter(cgroup.Devices)
insts, license, err := devicefilter.DeviceFilter(devices)
if err != nil {
return err
}
Expand Down

0 comments on commit ec49f98

Please sign in to comment.