Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.4] libpod: use new libcontainer blockIO constructors #19212

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 8 additions & 36 deletions libpod/oci_conmon_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,49 +267,25 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
if resource.BlockIO != nil {
if len(resource.BlockIO.ThrottleReadBpsDevice) > 0 {
for _, entry := range resource.BlockIO.ThrottleReadBpsDevice {
throttle := &runcconfig.ThrottleDevice{}
dev := &runcconfig.BlockIODevice{
Major: entry.Major,
Minor: entry.Minor,
}
throttle.BlockIODevice = *dev
throttle.Rate = entry.Rate
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
final.BlkioThrottleReadBpsDevice = append(final.BlkioThrottleReadBpsDevice, throttle)
}
}
if len(resource.BlockIO.ThrottleWriteBpsDevice) > 0 {
for _, entry := range resource.BlockIO.ThrottleWriteBpsDevice {
throttle := &runcconfig.ThrottleDevice{}
dev := &runcconfig.BlockIODevice{
Major: entry.Major,
Minor: entry.Minor,
}
throttle.BlockIODevice = *dev
throttle.Rate = entry.Rate
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
final.BlkioThrottleWriteBpsDevice = append(final.BlkioThrottleWriteBpsDevice, throttle)
}
}
if len(resource.BlockIO.ThrottleReadIOPSDevice) > 0 {
for _, entry := range resource.BlockIO.ThrottleReadIOPSDevice {
throttle := &runcconfig.ThrottleDevice{}
dev := &runcconfig.BlockIODevice{
Major: entry.Major,
Minor: entry.Minor,
}
throttle.BlockIODevice = *dev
throttle.Rate = entry.Rate
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
final.BlkioThrottleReadIOPSDevice = append(final.BlkioThrottleReadIOPSDevice, throttle)
}
}
if len(resource.BlockIO.ThrottleWriteIOPSDevice) > 0 {
for _, entry := range resource.BlockIO.ThrottleWriteIOPSDevice {
throttle := &runcconfig.ThrottleDevice{}
dev := &runcconfig.BlockIODevice{
Major: entry.Major,
Minor: entry.Minor,
}
throttle.BlockIODevice = *dev
throttle.Rate = entry.Rate
throttle := runcconfig.NewThrottleDevice(entry.Major, entry.Minor, entry.Rate)
final.BlkioThrottleWriteIOPSDevice = append(final.BlkioThrottleWriteIOPSDevice, throttle)
}
}
Expand All @@ -321,18 +297,14 @@ func GetLimits(resource *spec.LinuxResources) (runcconfig.Resources, error) {
}
if len(resource.BlockIO.WeightDevice) > 0 {
for _, entry := range resource.BlockIO.WeightDevice {
weight := &runcconfig.WeightDevice{}
dev := &runcconfig.BlockIODevice{
Major: entry.Major,
Minor: entry.Minor,
}
var w, lw uint16
if entry.Weight != nil {
weight.Weight = *entry.Weight
w = *entry.Weight
}
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)
}
}
Expand Down