mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
Merge pull request #19101 from haircommander/runc-bump
libpod: use new libcontainer BlockIO constructors
This commit is contained in:
@ -267,49 +267,25 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
|
|||||||
if resource.BlockIO != nil {
|
if resource.BlockIO != nil {
|
||||||
if len(resource.BlockIO.ThrottleReadBpsDevice) > 0 {
|
if len(resource.BlockIO.ThrottleReadBpsDevice) > 0 {
|
||||||
for _, entry := range resource.BlockIO.ThrottleReadBpsDevice {
|
for _, entry := range resource.BlockIO.ThrottleReadBpsDevice {
|
||||||
throttle := &runcconfig.ThrottleDevice{}
|
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
|
||||||
dev := &runcconfig.BlockIODevice{
|
|
||||||
Major: entry.Major,
|
|
||||||
Minor: entry.Minor,
|
|
||||||
}
|
|
||||||
throttle.BlockIODevice = *dev
|
|
||||||
throttle.Rate = entry.Rate
|
|
||||||
final.BlkioThrottleReadBpsDevice = append(final.BlkioThrottleReadBpsDevice, throttle)
|
final.BlkioThrottleReadBpsDevice = append(final.BlkioThrottleReadBpsDevice, throttle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(resource.BlockIO.ThrottleWriteBpsDevice) > 0 {
|
if len(resource.BlockIO.ThrottleWriteBpsDevice) > 0 {
|
||||||
for _, entry := range resource.BlockIO.ThrottleWriteBpsDevice {
|
for _, entry := range resource.BlockIO.ThrottleWriteBpsDevice {
|
||||||
throttle := &runcconfig.ThrottleDevice{}
|
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
|
||||||
dev := &runcconfig.BlockIODevice{
|
|
||||||
Major: entry.Major,
|
|
||||||
Minor: entry.Minor,
|
|
||||||
}
|
|
||||||
throttle.BlockIODevice = *dev
|
|
||||||
throttle.Rate = entry.Rate
|
|
||||||
final.BlkioThrottleWriteBpsDevice = append(final.BlkioThrottleWriteBpsDevice, throttle)
|
final.BlkioThrottleWriteBpsDevice = append(final.BlkioThrottleWriteBpsDevice, throttle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(resource.BlockIO.ThrottleReadIOPSDevice) > 0 {
|
if len(resource.BlockIO.ThrottleReadIOPSDevice) > 0 {
|
||||||
for _, entry := range resource.BlockIO.ThrottleReadIOPSDevice {
|
for _, entry := range resource.BlockIO.ThrottleReadIOPSDevice {
|
||||||
throttle := &runcconfig.ThrottleDevice{}
|
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
|
||||||
dev := &runcconfig.BlockIODevice{
|
|
||||||
Major: entry.Major,
|
|
||||||
Minor: entry.Minor,
|
|
||||||
}
|
|
||||||
throttle.BlockIODevice = *dev
|
|
||||||
throttle.Rate = entry.Rate
|
|
||||||
final.BlkioThrottleReadIOPSDevice = append(final.BlkioThrottleReadIOPSDevice, throttle)
|
final.BlkioThrottleReadIOPSDevice = append(final.BlkioThrottleReadIOPSDevice, throttle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(resource.BlockIO.ThrottleWriteIOPSDevice) > 0 {
|
if len(resource.BlockIO.ThrottleWriteIOPSDevice) > 0 {
|
||||||
for _, entry := range resource.BlockIO.ThrottleWriteIOPSDevice {
|
for _, entry := range resource.BlockIO.ThrottleWriteIOPSDevice {
|
||||||
throttle := &runcconfig.ThrottleDevice{}
|
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
|
||||||
dev := &runcconfig.BlockIODevice{
|
|
||||||
Major: entry.Major,
|
|
||||||
Minor: entry.Minor,
|
|
||||||
}
|
|
||||||
throttle.BlockIODevice = *dev
|
|
||||||
throttle.Rate = entry.Rate
|
|
||||||
final.BlkioThrottleWriteIOPSDevice = append(final.BlkioThrottleWriteIOPSDevice, throttle)
|
final.BlkioThrottleWriteIOPSDevice = append(final.BlkioThrottleWriteIOPSDevice, throttle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,18 +297,14 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
|
|||||||
}
|
}
|
||||||
if len(resource.BlockIO.WeightDevice) > 0 {
|
if len(resource.BlockIO.WeightDevice) > 0 {
|
||||||
for _, entry := range resource.BlockIO.WeightDevice {
|
for _, entry := range resource.BlockIO.WeightDevice {
|
||||||
weight := &runcconfig.WeightDevice{}
|
var w, lw uint16
|
||||||
dev := &runcconfig.BlockIODevice{
|
|
||||||
Major: entry.Major,
|
|
||||||
Minor: entry.Minor,
|
|
||||||
}
|
|
||||||
if entry.Weight != nil {
|
if entry.Weight != nil {
|
||||||
weight.Weight = *entry.Weight
|
w = *entry.Weight
|
||||||
}
|
}
|
||||||
if entry.LeafWeight != nil {
|
if entry.LeafWeight != nil {
|
||||||
weight.LeafWeight = *entry.LeafWeight
|
lw = *entry.LeafWeight
|
||||||
}
|
}
|
||||||
weight.BlockIODevice = *dev
|
weight := runcconfig.NewWeightDevice(entry.Major, entry.Minor, w, lw)
|
||||||
final.BlkioWeightDevice = append(final.BlkioWeightDevice, weight)
|
final.BlkioWeightDevice = append(final.BlkioWeightDevice, weight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user