-
-
Save diegoparrilla/8044656 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.read_bps_device | |
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.write_bps_device | |
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.read_bps_device | |
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.write_bps_device | |
# 10MBps | |
#BPSLIMIT=10485760 | |
# 200MBps | |
#BPSLIMIT=209715200 | |
# 50MBps | |
#BPSLIMIT=52428800 | |
# 30MBps | |
BPSLIMIT=31457280 | |
# unlimited / default | |
#BPSLIMIT=0 | |
DEV_MAJOR=253 | |
DEV_MINOR_LIST="0 1 2" | |
if [ -n "$1" ] | |
then | |
BPSLIMIT="$1" | |
fi | |
virsh list --name | while read n | |
do | |
[ -n "$n" ] || continue | |
echo $n | |
for DEV_MINOR in $DEV_MINOR_LIST | |
do | |
echo "$DEV_MAJOR:$DEV_MINOR $BPSLIMIT" > /cgroup/blkio/libvirt/qemu/$n/blkio.throttle.read_bps_device | |
echo "$DEV_MAJOR:$DEV_MINOR $BPSLIMIT" > /cgroup/blkio/libvirt/qemu/$n/blkio.throttle.write_bps_device | |
done | |
cat "/cgroup/blkio/libvirt/qemu/$n/blkio.throttle.read_bps_device" | |
cat "/cgroup/blkio/libvirt/qemu/$n/blkio.throttle.write_bps_device" | |
done | |
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.read_bps_device | |
cat /cgroup/blkio/libvirt/qemu/blkio.throttle.write_bps_device | |
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.read_bps_device | |
cat /cgroup/blkio/libvirt/qemu/*/blkio.throttle.write_bps_device | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment