Index: drbl-virt/sbin/drbl_kvm_patch.sh
===================================================================
--- drbl-virt/sbin/drbl_kvm_patch.sh	(revision 215)
+++ drbl-virt/sbin/drbl_kvm_patch.sh	(revision 216)
@@ -22,4 +22,5 @@
 # == check KVM Kernel version
 check_kvm
+echo $KVM_Kernel > $Work_Home/etc/KVM_Kernel
 
 # == Modify PXE booting menu ==
Index: drbl-virt/sbin/drbl_kvm_repush.sh
===================================================================
--- drbl-virt/sbin/drbl_kvm_repush.sh	(revision 216)
+++ drbl-virt/sbin/drbl_kvm_repush.sh	(revision 216)
@@ -0,0 +1,91 @@
+#!/bin/bash
+# Program:
+#   Repush DRBL environment (KVM environment)
+# Author:
+#   Jazz, Rock {jazz, rock}@nchc.org.tw
+# Version:
+#    1.0
+# History:
+#   2010/07/20  Rock    First release (1.0)
+
+# [Source]
+source /opt/drbl-virt/conf/drbl-virt.conf
+source $Work_Path/functions_drbl_virt
+
+# [Main]
+
+# = 1. Variables setup =
+# == Get DRBL eth ==
+eths=""
+declare -i eth_nu=""
+get_DRBL_eth
+
+if [ $eth_nu -gt "1" ]; then
+    echo ""
+    echo "DRBL environment has muiltpule netwrok card(NIC)."
+fi
+
+# backup IP_HOST_TABLE
+if [ -e /etc/drbl/IP_HOST_TABLE.drbl-virt_bak ]; then
+    cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
+    cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /etc/drbl/IP_HOST_TABLE
+    cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /opt/drbl-virt/etc/IP_HOST_TABLE
+else
+    cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.drbl-virt_bak
+    cp /etc/drbl/IP_HOST_TABLE /opt/drbl-virt/etc/IP_HOST_TABLE
+fi
+
+# backup mac address file
+cp /etc/drbl/macadr-eth*[0-9].txt /opt/drbl-virt/etc/
+
+for eth in $eths
+do
+
+    # == Get Host IP range/number  ==
+    Host_first_IP=""
+    Host_last_IP=""
+    # get eth network
+    eth_address=$(/opt/drbl/bin/drbl-get-ipadd $eth)
+    eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $eth)
+    eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
+    get_Host_IP_range
+
+    # == Get VM number, IP range & prefix name ==
+    declare -i VM_IP_range=""
+    declare -i Host_last_IP_4=""
+    declare -i VM_Host_totoal_nu=""
+    VM_first_IP=""
+    VM_last_IP=""
+    VM_prefix_name=""
+
+    get_VM_IP_range_and_prefix_name
+    create_VM_IP_table
+
+    # == Generate MAC address  ==
+    # MAC address [00:16:3e:xx:xx:xx] is for Xen use
+    generate_Xen_MAC_address
+
+    # == Add VM IP to /etc/drbl/IP_HOST_TABLE  ==
+    VM_IPs=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $1}')
+    VM_IPs_nu=$(cat /opt/drbl-virt/etc/IP_VM_eth1 | awk '{print $1}' | wc -w)
+    VM_hosts=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $2}')
+    VM_MACs=$(cat /opt/drbl-virt/etc/macadr-VM-$eth.txt)
+
+    # == Add Mac address to macadr-ethX.txt ==
+    if [ -e /etc/drbl/macadr-$eth.txt ]; then
+    delete_duplicating_MAC
+    fi
+    cat /opt/drbl-virt/etc/macadr-VM-$eth.txt >> /etc/drbl/macadr-$eth.txt
+done
+
+
+# = 2. Re-deploy drbl client =
+# == Change KVM Kernel ==
+KVM_Kernel=$(cat $Work_Home/etc/KVM_Kernel)
+echo "/opt/drbl/sbin/drblsrv-offline -s $KVM_Kernel"
+/opt/drbl/sbin/drblsrv-offline -s $KVM_Kernel
+# == Re-delpoy drbl client ==
+echo -e "\nRe-delpoy drbl client"
+echo -e "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf\n"
+/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
+echo ""
Index: drbl-virt/sbin/drbl_virt.sh
===================================================================
--- drbl-virt/sbin/drbl_virt.sh	(revision 215)
+++ drbl-virt/sbin/drbl_virt.sh	(revision 216)
@@ -32,4 +32,5 @@
     $Work_Path/drbl_kvm_patch.sh
     # drbl re-push KVM environment
+    $Work_Path/drbl_kvm_repush.sh
 fi
 
Index: drbl-virt/sbin/drbl_xen_repush.sh
===================================================================
--- drbl-virt/sbin/drbl_xen_repush.sh	(revision 215)
+++ drbl-virt/sbin/drbl_xen_repush.sh	(revision 216)
@@ -1,11 +1,11 @@
 #!/bin/bash
 # Program:
-#   Path DRBL evironment to support Xen/KVM
-# Author: 
+#   Repush DRBL evironment (Xen environment)
+# Author:
 #   Jazz, Rock {jazz, rock}@nchc.org.tw
 # Version:
 #    1.0
-# History:                                                                                          
-#   2010/07/20  Rock    First release (1.0) 
+# History:
+#   2010/07/20  Rock    First release (1.0)
 
 # [Source]
@@ -19,11 +19,11 @@
 eths=""
 declare -i eth_nu=""
-get_DRBL_eth                                                                                                                                                                           
-     
+get_DRBL_eth
+
 if [ $eth_nu -gt "1" ]; then
     echo ""
     echo "DRBL environment has muiltpule netwrok card(NIC)."
-fi   
-   
+fi
+
 # backup IP_HOST_TABLE
 if [ -e /etc/drbl/IP_HOST_TABLE.drbl-virt_bak ]; then
@@ -34,5 +34,5 @@
     cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.drbl-virt_bak
     cp /etc/drbl/IP_HOST_TABLE /opt/drbl-virt/etc/IP_HOST_TABLE
-fi  
+fi
 
 # backup mac address file
@@ -40,6 +40,6 @@
 
 for eth in $eths
-do   
-     
+do
+
     # == Get Host IP range/number  ==
     Host_first_IP=""
@@ -50,5 +50,5 @@
     eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
     get_Host_IP_range
-     
+
     # == Get VM number, IP range & prefix name ==
     declare -i VM_IP_range=""
@@ -61,9 +61,9 @@
     get_VM_IP_range_and_prefix_name
     create_VM_IP_table
-     
+
     # == Generate MAC address  ==
     # MAC address [00:16:3e:xx:xx:xx] is for Xen use
     generate_Xen_MAC_address
-     
+
     # == Add VM IP to /etc/drbl/IP_HOST_TABLE  ==
     VM_IPs=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $1}')
@@ -71,5 +71,5 @@
     VM_hosts=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $2}')
     VM_MACs=$(cat /opt/drbl-virt/etc/macadr-VM-$eth.txt)
-    
+
     # == Add Mac address to macadr-ethX.txt ==
     if [ -e /etc/drbl/macadr-$eth.txt ]; then
@@ -77,16 +77,15 @@
     fi
     cat /opt/drbl-virt/etc/macadr-VM-$eth.txt >> /etc/drbl/macadr-$eth.txt
-done 
-     
+done
+
 
 # = 2. Re-deploy drbl client =
-# == Cheange Xen Kernel ==   
+# == Change Xen Kernel ==
 Xen_Kernel=$(cat $Work_Home/etc/Xen_Kernel)
 #read -p "Xen_Kernel=$Xen_Kernel"
-echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel"
-/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel                                                                                                                        
-echo "" 
+echo  "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel"
+/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel
 # == Re-delpoy drbl client ==
-echo "Re-delpoy drbl client"           
+echo -e "\nRe-delpoy drbl client"
 echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf"
 /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
