This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new a87acf9  kvm: improved performance on creating VM  (#2923)
a87acf9 is described below

commit a87acf93d8705cccf91fda3c702da04c365d9e9d
Author: alexanderbazhenoff <[email protected]>
AuthorDate: Thu Oct 25 13:58:13 2018 +0300

    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.
---
 scripts/vm/network/vnet/modifyvlan.sh | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/scripts/vm/network/vnet/modifyvlan.sh 
b/scripts/vm/network/vnet/modifyvlan.sh
index 24a38a1..affa778 100755
--- a/scripts/vm/network/vnet/modifyvlan.sh
+++ b/scripts/vm/network/vnet/modifyvlan.sh
@@ -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

Reply via email to