kvm: improved performance on creating VM (#2923)

Improved performance on creating VM for KVM virtualization.

On a huge hosts every "ifconfig | grep" takes a lot of time (about 2.5-3 minutes on hosts with 500 machines). For example: ip link show dev $vlanDev > /dev/null is faster than ifconfig |grep -w $vlanDev > /dev/null. But using ip command is much better. Using this patch you can create 500s machine in 10 seconds. You don't need slow ifconfig prints anymore.
This commit is contained in:
alexanderbazhenoff 2018-10-25 13:58:13 +03:00 committed by Rohit Yadav
parent 9cf57d2568
commit a87acf93d8

View File

@ -48,11 +48,7 @@ addVlan() {
fi
# is up?
ifconfig |grep -w $vlanDev > /dev/null
if [ $? -gt 0 ]
then
ifconfig $vlanDev up > /dev/null
fi
ip link set $vlanDev up > /dev/null 2>/dev/null
if [ ! -d /sys/class/net/$vlanBr ]
then
@ -86,11 +82,7 @@ addVlan() {
fi
fi
# is vlanBr up?
ifconfig |grep -w $vlanBr > /dev/null
if [ $? -gt 0 ]
then
ifconfig $vlanBr up
fi
ip link set $vlanBr up > /dev/null 2>/dev/null
return 0
}
@ -109,7 +101,7 @@ deleteVlan() {
return 1
fi
ifconfig $vlanBr down
ip link set $vlanBr down
if [ $? -gt 0 ]
then