From 56abe735f2bce40b63744cabe2e16f2286e6f233 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 10 Jun 2016 18:11:20 -0700 Subject: [PATCH] bug fix, LeafWeight nil err Signed-off-by: root --- libcontainer/specconv/spec_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libcontainer/specconv/spec_linux.go b/libcontainer/specconv/spec_linux.go index 4c6f7b7a..013bd185 100644 --- a/libcontainer/specconv/spec_linux.go +++ b/libcontainer/specconv/spec_linux.go @@ -392,7 +392,14 @@ func createCgroupConfig(name string, useSystemdCgroup bool, spec *specs.Spec) (* } if r.BlockIO.WeightDevice != nil { for _, wd := range r.BlockIO.WeightDevice { - weightDevice := configs.NewWeightDevice(wd.Major, wd.Minor, *wd.Weight, *wd.LeafWeight) + var weight, leafWeight uint16 + if wd.Weight != nil { + weight = *wd.Weight + } + if wd.LeafWeight != nil { + leafWeight = *wd.LeafWeight + } + weightDevice := configs.NewWeightDevice(wd.Major, wd.Minor, weight, leafWeight) c.Resources.BlkioWeightDevice = append(c.Resources.BlkioWeightDevice, weightDevice) } }