Skip to content

Commit e1246ba

Browse files
jongwuthaJeztah
authored andcommitted
run: fix GetList return empty issue for throttledevice
Test "--device-read-bps" "--device-write-bps" will fail. The root cause is that GetList helper return empty as its local variable initialized to zero size. This patch fix it by setting the related slice size to non-zero. Signed-off-by: Jianyong Wu <wujianyong@hygon.cn> Fixes: #5321 (cherry picked from commit 73e78a5) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent a72d7cd commit e1246ba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

opts/throttledevice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (opt *ThrottledeviceOpt) String() string {
9494

9595
// GetList returns a slice of pointers to ThrottleDevices.
9696
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
97-
out := make([]*blkiodev.ThrottleDevice, 0, len(opt.values))
97+
out := make([]*blkiodev.ThrottleDevice, len(opt.values))
9898
copy(out, opt.values)
9999
return out
100100
}

0 commit comments

Comments
 (0)