Hey, the KVM / QEMU script that adds a VM to a (host-)bridge cant handle setups where a system got more than one bridge. The simple workaround (store result in an array) below will use the first bridge in all situations - which is not perfect. The right fix would be define a bridge to the cmd when KVM/QEMU is started. /etc/kvm/kvm-ifup -switch=$(/sbin/ip route list | awk '/^default / { sub(/.* dev /, ""); print $1 }') +switch=( $(/sbin/ip route list | awk '/^default / { sub(/.* dev /, ""); print $1 }') ) -switch=$(/bin/netstat -rn | awk '/^0\.0\.0\.0/ { print $NF }') +switch=( $(/bin/netstat -rn | awk '/^0\.0\.0\.0/ { print $NF }') ) Reproducible: Always
I don't use the script myself (I use vde exclusively). If you can come up with a new script that works better, I'm willing to include it.
Created attachment 174696 [details] kvm-ifup script with support for more than one bridge on the system made a small change to the kvm-ifup script so it will not fail if there is more than one bridge on the system - which bridge is used depends only on the output of ifconfig / ip :-/ If more than one bridge is found a warning is send to syslog
Created attachment 174698 [details] kvm-ifdown script with support for more than one bridge on the system
Thanks. I'll include them in the next bump (which probably won't be 80, since it has so many regressions)
thanks for your work!
(In reply to comment #2) > Created an attachment (id=174696) This bit: [[ ${switch#} -ne "1" ]] && logger -t kvm "$0 found more than one bridge connecting $1 to ${switch}" ...will always log the warning. "${foo#}" doesn't print the number of words in $foo, it's just the same as saying "${foo}". The construction "${#foo}" will print the number of characters (not words). I don't know how to get what you want in plain shell, I'd have to do something like, [[ $( echo $switch |wc -w ) -ne "1" ]]
Created attachment 198274 [details] kvm-ifdown for multiple bridges New version of the kvm-ifdown script which combs through the output of 'brctl show' looking for the named interface, and detaches it wherever we find it.
I can't maintain kvm anymore.
I added some changes to the vde ebuild to support multiple bridges. I'll check if that can be applied here.
This is one of the reasons it was removed.