Last active
November 22, 2022 19:21
-
-
Save Multikas/ebdabe800b4e6df5d232 to your computer and use it in GitHub Desktop.
Script for limiting SmartOS zones bandwidth.
This file contains 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
#!/usr/bin/bash | |
# | |
# Script should be run in GZ. | |
# | |
# example: | |
# ./add-flow-to-vm.sh c480b89f-f8a1-41b1-abd0-45bac4685cb2 15M | |
# | |
# It will add TCP/UDP flows for this particular VM, and limits bandwidth to 15Mbps | |
# | |
VM_UUID=$1 | |
MAXBW=$2 | |
for next in `vmadm get $VM_UUID | grep interface | awk -F\" '{ print $4 }'` | |
do | |
flowadm add-flow -l $next -z $VM_UUID -a transport=tcp -p maxbw=$MAXBW $VM_UUID-$next-tcp | |
flowadm add-flow -l $next -z $VM_UUID -a transport=udp -p maxbw=$MAXBW $VM_UUID-$next-udp | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simpler version Smart OS build 20181206
dladm set-linkprop -z $VM_UUID -p maxbw=15M eth0
It'll be remove after vm reboot