diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-03-09 10:28:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 10:28:24 -0500 |
commit | 418ab2e5e154cb0df13f2e901cf4aea31a5cd0a9 (patch) | |
tree | 8eec9ed44001e446dbfb206f9da4d308edfeec5a /pkg | |
parent | ea4248dc26f93bcabaa8a7267bfaf9ee40254666 (diff) | |
parent | d2f77c256836e8a1a562d56eed7d92fdb18a2f76 (diff) | |
download | podman-418ab2e5e154cb0df13f2e901cf4aea31a5cd0a9.tar.gz podman-418ab2e5e154cb0df13f2e901cf4aea31a5cd0a9.tar.bz2 podman-418ab2e5e154cb0df13f2e901cf4aea31a5cd0a9.zip |
Merge pull request #13421 from hshiina/device-rule
Set default rule at the head of device configuration
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/oci.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index 8b3550e36..1cc3a463f 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -332,6 +332,11 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt } // Devices + // set the default rule at the beginning of device configuration + if !inUserNS && !s.Privileged { + g.AddLinuxResourcesDevice(false, "", nil, nil, "rwm") + } + var userDevices []spec.LinuxDevice if s.Privileged { // If privileged, we need to add all the host devices to the @@ -363,7 +368,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt // set the devices cgroup when not running in a user namespace if !inUserNS && !s.Privileged { - g.AddLinuxResourcesDevice(false, "", nil, nil, "rwm") for _, dev := range s.DeviceCgroupRule { g.AddLinuxResourcesDevice(true, dev.Type, dev.Major, dev.Minor, dev.Access) } |