Browse code

Add more error message for ops when container limit use an device which not exist

Signed-off-by: Jeff Zvier <zvier20@gmail.com>

Jeff Zvier authored on 2020/08/09 09:27:43
Showing 1 changed files
... ...
@@ -187,7 +187,7 @@ func getBlkioWeightDevices(config containertypes.Resources) ([]specs.LinuxWeight
187 187
 
188 188
 	for _, weightDevice := range config.BlkioWeightDevice {
189 189
 		if err := unix.Stat(weightDevice.Path, &stat); err != nil {
190
-			return nil, err
190
+			return nil, errors.WithStack(&os.PathError{Op: "stat", Path: weightDevice.Path, Err: err})
191 191
 		}
192 192
 		weight := weightDevice.Weight
193 193
 		d := specs.LinuxWeightDevice{Weight: &weight}
... ...
@@ -260,7 +260,7 @@ func getBlkioThrottleDevices(devs []*blkiodev.ThrottleDevice) ([]specs.LinuxThro
260 260
 
261 261
 	for _, d := range devs {
262 262
 		if err := unix.Stat(d.Path, &stat); err != nil {
263
-			return nil, err
263
+			return nil, errors.WithStack(&os.PathError{Op: "stat", Path: d.Path, Err: err})
264 264
 		}
265 265
 		d := specs.LinuxThrottleDevice{Rate: d.Rate}
266 266
 		// the type is 32bit on mips