File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
inspecttypes/dockercompat Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -773,7 +773,18 @@ func withInternalLabels(internalLabels internalLabels) (containerd.NewContainerO
773773 }
774774
775775 if len (internalLabels .deviceMapping ) > 0 {
776- hostConfigLabel .DeviceMapping = internalLabels .deviceMapping
776+ for i := range internalLabels .deviceMapping {
777+ var deviceMapping dockercompat.DeviceMapping
778+ device := internalLabels .deviceMapping [i ]
779+ devPath , conPath , mode , err := ParseDevice (device )
780+ if err != nil {
781+ return nil , err
782+ }
783+ deviceMapping .CgroupPermissions = mode
784+ deviceMapping .PathInContainer = conPath
785+ deviceMapping .PathOnHost = devPath
786+ hostConfigLabel .Devices = append (hostConfigLabel .Devices , deviceMapping )
787+ }
777788 }
778789
779790 hostConfigJSON , err := json .Marshal (hostConfigLabel )
Original file line number Diff line number Diff line change @@ -239,9 +239,15 @@ type DNSSettings struct {
239239}
240240
241241type HostConfigLabel struct {
242- BlkioWeight uint16
243- CidFile string
244- DeviceMapping []string
242+ BlkioWeight uint16
243+ CidFile string
244+ Devices []DeviceMapping
245+ }
246+
247+ type DeviceMapping struct {
248+ PathOnHost string
249+ PathInContainer string
250+ CgroupPermissions string
245251}
246252
247253type CPUSettings struct {
You can’t perform that action at this time.
0 commit comments