@@ -395,25 +395,41 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (*
395395 }
396396 if r .BlockIO .ThrottleReadBpsDevice != nil {
397397 for _ , td := range r .BlockIO .ThrottleReadBpsDevice {
398- throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , * td .Rate )
398+ var rate uint64
399+ if td .Rate != nil {
400+ rate = * td .Rate
401+ }
402+ throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , rate )
399403 c .Resources .BlkioThrottleReadBpsDevice = append (c .Resources .BlkioThrottleReadBpsDevice , throttleDevice )
400404 }
401405 }
402406 if r .BlockIO .ThrottleWriteBpsDevice != nil {
403407 for _ , td := range r .BlockIO .ThrottleWriteBpsDevice {
404- throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , * td .Rate )
408+ var rate uint64
409+ if td .Rate != nil {
410+ rate = * td .Rate
411+ }
412+ throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , rate )
405413 c .Resources .BlkioThrottleWriteBpsDevice = append (c .Resources .BlkioThrottleWriteBpsDevice , throttleDevice )
406414 }
407415 }
408416 if r .BlockIO .ThrottleReadIOPSDevice != nil {
409417 for _ , td := range r .BlockIO .ThrottleReadIOPSDevice {
410- throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , * td .Rate )
418+ var rate uint64
419+ if td .Rate != nil {
420+ rate = * td .Rate
421+ }
422+ throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , rate )
411423 c .Resources .BlkioThrottleReadIOPSDevice = append (c .Resources .BlkioThrottleReadIOPSDevice , throttleDevice )
412424 }
413425 }
414426 if r .BlockIO .ThrottleWriteIOPSDevice != nil {
415427 for _ , td := range r .BlockIO .ThrottleWriteIOPSDevice {
416- throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , * td .Rate )
428+ var rate uint64
429+ if td .Rate != nil {
430+ rate = * td .Rate
431+ }
432+ throttleDevice := configs .NewThrottleDevice (td .Major , td .Minor , rate )
417433 c .Resources .BlkioThrottleWriteIOPSDevice = append (c .Resources .BlkioThrottleWriteIOPSDevice , throttleDevice )
418434 }
419435 }
0 commit comments