-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathset_io_limits.sh
More file actions
executable file
·27 lines (27 loc) · 1.06 KB
/
set_io_limits.sh
File metadata and controls
executable file
·27 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
IFS="
"
eval declare -A adminvps=($(for i in $(curl -s https://myvps.interserver.net/adminvps.php); do echo -n "[$i]=1 ";done))
eval declare -A runningvps=($(for i in $(virsh list --name); do echo "[$i]=1 ";done))
for line in $(cat /root/cpaneldirect/vps.slicemap); do
vps=$(echo $line|cut -d: -f1)
slices=$(echo $line|cut -d: -f2)
iops=$((100 + $((100 * $slices))))
io=$((100000000 * $slices))
echo -n "vps $vps: slices $slices = iops ${iops} + io ${io}, "
if [ -e "/vz/$vps/protected" ]; then
echo "skipping protected vps"
continue;
elif [ "${adminvps[$vps]}" = "1" ]; then
echo "skipping interserver/admin service"
continue;
fi
for dev in $(virsh domblklist $vps|grep "^ .* */"|cut -d" " -f2); do
echo -n "updating $dev config, "
virsh blkdeviotune $vps $dev --total-iops-sec ${iops} --total-bytes-sec ${io} --config |grep -v "^$"
if [ "${runningvps[$vps]}" = "1" ]; then
echo "updating $dev live"
virsh blkdeviotune $vps $dev --total-iops-sec ${iops} --total-bytes-sec ${io} --live |grep -v "^$"
fi
done
done