summaryrefslogtreecommitdiff
path: root/vendor/github.com/containerd/cgroups/blkio.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-01-08 14:52:57 +0100
committerValentin Rothberg <rothberg@redhat.com>2019-01-11 13:38:11 +0100
commitbd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87 (patch)
tree5f06e4e289f16d9164d692590a3fe6541b5384cf /vendor/github.com/containerd/cgroups/blkio.go
parent545f24421247c9f6251a634764db3f8f8070a812 (diff)
downloadpodman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.gz
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.bz2
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.zip
vendor: update everything
* If possible, update each dependency to the latest available version. * Use releases over commit IDs and avoid vendoring branches. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/containerd/cgroups/blkio.go')
-rw-r--r--vendor/github.com/containerd/cgroups/blkio.go55
1 files changed, 33 insertions, 22 deletions
diff --git a/vendor/github.com/containerd/cgroups/blkio.go b/vendor/github.com/containerd/cgroups/blkio.go
index fc1e689cb..875fb5546 100644
--- a/vendor/github.com/containerd/cgroups/blkio.go
+++ b/vendor/github.com/containerd/cgroups/blkio.go
@@ -191,31 +191,42 @@ func (b *blkioController) readEntry(devices map[deviceKey]string, path, name str
}
func createBlkioSettings(blkio *specs.LinuxBlockIO) []blkioSettings {
- settings := []blkioSettings{
- {
- name: "weight",
- value: blkio.Weight,
- format: uintf,
- },
- {
- name: "leaf_weight",
- value: blkio.LeafWeight,
- format: uintf,
- },
- }
- for _, wd := range blkio.WeightDevice {
+ settings := []blkioSettings{}
+
+ if blkio.Weight != nil {
settings = append(settings,
blkioSettings{
- name: "weight_device",
- value: wd,
- format: weightdev,
- },
+ name: "weight",
+ value: blkio.Weight,
+ format: uintf,
+ })
+ }
+ if blkio.LeafWeight != nil {
+ settings = append(settings,
blkioSettings{
- name: "leaf_weight_device",
- value: wd,
- format: weightleafdev,
+ name: "leaf_weight",
+ value: blkio.LeafWeight,
+ format: uintf,
})
}
+ for _, wd := range blkio.WeightDevice {
+ if wd.Weight != nil {
+ settings = append(settings,
+ blkioSettings{
+ name: "weight_device",
+ value: wd,
+ format: weightdev,
+ })
+ }
+ if wd.LeafWeight != nil {
+ settings = append(settings,
+ blkioSettings{
+ name: "leaf_weight_device",
+ value: wd,
+ format: weightleafdev,
+ })
+ }
+ }
for _, t := range []struct {
name string
list []specs.LinuxThrottleDevice
@@ -265,12 +276,12 @@ func uintf(v interface{}) []byte {
func weightdev(v interface{}) []byte {
wd := v.(specs.LinuxWeightDevice)
- return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, wd.Weight))
+ return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, *wd.Weight))
}
func weightleafdev(v interface{}) []byte {
wd := v.(specs.LinuxWeightDevice)
- return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, wd.LeafWeight))
+ return []byte(fmt.Sprintf("%d:%d %d", wd.Major, wd.Minor, *wd.LeafWeight))
}
func throttleddev(v interface{}) []byte {