mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
test/system: Use correct device for I/O limit tests
The tests were incorrectly using `/dev/zero`. These options are intended to set I/O limits on specific block devices. The test already sets up a loopback device, so reuse it. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -1123,18 +1123,24 @@ EOF
|
||||
@test "podman run --device-read-bps" {
|
||||
skip_if_rootless "cannot use this flag in rootless mode"
|
||||
|
||||
if test \! -e /dev/nullb0; then
|
||||
skip "/dev/nullb0 not present, use 'modprobe null_blk nr_devices=1' to create it"
|
||||
fi
|
||||
|
||||
local cid
|
||||
local dev_maj_min=$(stat -c %Hr:%Lr /dev/nullb0)
|
||||
|
||||
# this test is a triple check on blkio flags since they seem to sneak by the tests
|
||||
if is_cgroupsv2; then
|
||||
run_podman run -dt --device-read-bps=/dev/zero:1M $IMAGE top
|
||||
run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top
|
||||
cid=$output
|
||||
run_podman exec -it $output cat /sys/fs/cgroup/io.max
|
||||
is "$output" ".*1:5 rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*"
|
||||
is "$output" ".*$dev_maj_min rbps=1048576 wbps=max riops=max wiops=max" "throttle devices passed successfully.*"
|
||||
else
|
||||
run_podman run -dt --device-read-bps=/dev/zero:1M $IMAGE top
|
||||
run_podman run -dt --device-read-bps=/dev/nullb0:1M $IMAGE top
|
||||
cid=$output
|
||||
run_podman exec -it $output cat /sys/fs/cgroup/blkio/blkio.throttle.read_bps_device
|
||||
is "$output" ".*1:5 1048576" "throttle devices passed successfully.*"
|
||||
is "$output" ".*$dev_maj_min 1048576" "throttle devices passed successfully.*"
|
||||
fi
|
||||
run_podman container rm -f -t0 $cid
|
||||
}
|
||||
|
@ -63,10 +63,10 @@ memory-reservation = 400M | 2 | $mm.soft_limit_in_bytes = 419430400
|
||||
blkio-weight = 321 | - | - | io.bfq.weight = default 321 $lomajmin 98
|
||||
blkio-weight-device = $LOOPDEVICE:98 | - | - | io.bfq.weight = default 321 $lomajmin 98
|
||||
|
||||
device-read-bps = /dev/zero:10mb | - | - | io.max = $devicemax
|
||||
device-read-iops = /dev/zero:2000 | - | - | io.max = $devicemax
|
||||
device-write-bps = /dev/zero:30mb | - | - | io.max = $devicemax
|
||||
device-write-iops = /dev/zero:4000 | - | - | io.max = $devicemax
|
||||
device-read-bps = $LOOPDEVICE:10mb | - | - | io.max = $devicemax
|
||||
device-read-iops = $LOOPDEVICE:2000 | - | - | io.max = $devicemax
|
||||
device-write-bps = $LOOPDEVICE:30mb | - | - | io.max = $devicemax
|
||||
device-write-iops = $LOOPDEVICE:4000 | - | - | io.max = $devicemax
|
||||
"
|
||||
|
||||
# Run a container
|
||||
|
Reference in New Issue
Block a user