Index: drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh
===================================================================
--- drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh	(revision 180)
+++ drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh	(revision 180)
@@ -0,0 +1,56 @@
+#!/bin/bash                                                                                                          
+# Program:
+#   Path DRBL evironment to support Xen/KVM
+# Author: 
+#   Jazz, Rock {jazz, rock}@nchc.org.tw
+# Version:
+#    1.0
+# History:                                                                                          
+#   2010/08/13  Rock    First release (1.0) 
+ 
+# [Source]
+source /opt/drbl-virt/conf/drbl-virt.conf
+source $Work_Path/functions_drbl_virt
+
+# [Main]
+# = 0. 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
+
+for eth in $eths
+do
+
+    # == Get Host IP range/number  ==
+    Host_first_IP=""
+    Host_last_IP=""
+    get_Host_IP_range $eth
+    # == Get VM number & IP range  ==
+    VM_IP_range=""
+    VM_first_IP=""
+    VM_last_IP=""
+    get_VM_IP_range $eth
+    # == Get VM IP prefix hostname  ==
+    VM_prefix_name=""
+    get_VM_prefix_name $eth
+    
+done
+
+
+# = 1. Copy VM fs =
+# Kernel & initrd -> /home/domains
+
+
+# = 2. Add NFS config =
+
+# = 3. Add DHCP config =
+
+# = 4. Add hosts and cp it to all drbl client =
+
+# = 5. generate guest config file =
Index: drbl-virt/sbin/drbl_PXE_VM_create.sh
===================================================================
--- drbl-virt/sbin/drbl_PXE_VM_create.sh	(revision 179)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#!/bin/bash                                                                                                          
-# Program:
-#   Path DRBL evironment to support Xen/KVM
-# Author: 
-#   Jazz, Rock {jazz, rock}@nchc.org.tw
-# Version:
-#    1.0
-# History:                                                                                          
-#   2010/08/13  Rock    First release (1.0) 
- 
-# [Source]
-source /opt/drbl-virt/conf/drbl-virt.conf
-source $Work_Path/functions_drbl_virt
-
-# [Main]
-# = 0. Variables setup =
-# == Get Host IP range/number  == #
-Host_first_IP=""
-Host_final_IP=""
-get_Host_IP_range
-# == Get VM IP range/number  == #
-VM_IP_range=""
-VM_first_IP=""
-VM_final_IP=""
-get_VM_IP_range
-# == Get VM IP prefix hostname  == #
-
-
-# = 1. Copy VM fs =
-
-# = 2. Add NFS config =
-
-# = 3. Add DHCP config =
-
-# = 4. Add hosts and cp it to all drbl client =
-
-# = 5. generate guest config file =
Index: drbl-virt/sbin/functions_drbl_virt
===================================================================
--- drbl-virt/sbin/functions_drbl_virt	(revision 179)
+++ drbl-virt/sbin/functions_drbl_virt	(revision 180)
@@ -50,4 +50,5 @@
 # [Select Hypervisior(Xen/KVM)]
 function VMM_select(){
+echo ""
 if [ $cpu_flag == "yes" ]; then
     while [ "$VMM_select" != "1" -a "$VMM_select" != "2"  ]
@@ -56,7 +57,7 @@
     done
 	if [ $VMM_select == "1"  ]; then
-	  echo "Xen" > $Work_Home/.tmp/hypervisior
+	  echo "Xen" > $Work_Home/etc/hypervisior
 	else
-	  echo "KVM" > $Work_Home/.tmp/hypervisior
+	  echo "KVM" > $Work_Home/etc/hypervisior
 	fi	
 else
@@ -65,5 +66,5 @@
     echo ""
     VMM_select=1
-    echo "Xen" > $Work_Home/.tmp/hypervisior
+    echo "Xen" > $Work_Home/etc/hypervisior
 fi  
 }   
@@ -73,4 +74,5 @@
 function install_drbl-virt_dir(){
     mkdir -p $Work_Home/.tmp
+    mkdir -p $Work_Home/etc
 }
 
@@ -78,5 +80,5 @@
 # [Check Hypervisior]
 function check_hypervisior(){
-    hypervisior=$(cat $Work_Home/.tmp/hypervisior)    
+    hypervisior=$(cat $Work_Home/etc/hypervisior)    
 }
 
@@ -154,40 +156,69 @@
 
 
+function get_DRBL_eth(){
+eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt | cut -d "-" -f2 | cut -d "." -f1)
+eths_nu=$(echo $eths | wc -l)
+
+
+}
+
 function get_Host_IP_range(){
-cat /etc/drbl/IP_HOST_TABLE | sed "${Host_first_Line}p" 
-cat /etc/drbl/IP_HOST_TABLE | sed "${Host_final_Line}p"                    
-declare -i Host_first_Line=$(cat -n /etc/drbl/IP_HOST_TABLE  | grep "# Created by DRBL (drblpush), begin" | awk '{print $1}')
-Host_first_Line=$((${Host_first_Line}+1))
-                        
-declare -i Host_final_Line=$(cat -n /etc/drbl/IP_HOST_TABLE  | grep "# Created by DRBL (drblpush), end" | awk '{print $1}')
-Host_final_Line=$((${Host_final_Line}-1))
-#echo "$Host_first_Line"
-#echo "$Host_final_Line"
-                                                                           
-Host_first_IP=$(cat /etc/drbl/IP_HOST_TABLE | sed -n "${Host_first_Line}p"| awk '{print $1}')
-Host_final_IP=$(cat /etc/drbl/IP_HOST_TABLE | sed -n "${Host_final_Line}p"| awk '{print $1}')
-#echo $Host_first_IP                                                                                                                                                 
-#echo $Host_final_IP
+if [ ! -e /usr/bin/ipcalc ] || [ ! -e /opt/drbl/bin/drbl-get-network ] || [ ! -e /opt/drbl/bin/drbl-get-ipadd ]; then
+    echo "Don't find /usr/bin/ipcalc /opt/drbl/bin/drbl-get-network & /opt/drbl/bin/drbl-get-ipadd"
+    exit 0
+fi
+
+# get eth network
+eth_address=$(/opt/drbl/bin/drbl-get-ipadd $1)
+eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $1)
+eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
+eth_network_f3=$(echo $eth_network | cut -d "." -f 1-3)
+
+IP_nu=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | wc -l)
+Host_first_IP=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | awk "NR==1 {print $1}" | awk '{print 1}')
+Host_last_IP=$(cat /etc/drbl/IP_HOST_TABLE | grep $eth_network_f3 | awk "NR==$IP_nu {print $1}"| awk '{print $1}')
+
 }
 
 function get_VM_IP_range(){
-echo ""        
-echo "Your drbl client IP range $Host_first_IP ~ $Host_final_IP"
-declare -i Host_final_IP_4=$(echo $Host_final_IP | cut -d "." -f4)
-Host_final_IP_4=$(($Host_final_IP_4+1))                       
-VM_first_IP=$(echo $Host_final_IP | cut -d "." -f 1-3)
-VM_first_IP="${VM_first_IP}.${Host_final_IP_4}"       
-echo "The VM IP Range will start from $VM_first_IP"   
-while [ $jude != "yes" -a $jude != "y" ];             
-do             
-    read "Input your IP range for VM: " VM_IP_range   
-done           
-echo "VM_first_IP=$VM_first_IP" > $Work_Home/.tmp/IP_VM_TABLE
-echo "VM_IP_range=$VM_IP_range" >> $Work_Home/.tmp/IP_VM_TABLE
-
-}
-
-# [DRBL Check]
-
-
-
+echo ""
+echo "DRBL client IP range -> $1 [$Host_first_IP ~ $Host_last_IP]"
+
+declare -i Host_last_IP_4=$(echo $Host_last_IP | cut -d "." -f4)
+Host_last_IP_4=$(($Host_last_IP_4+1))
+VM_first_IP=$(echo $Host_last_IP | cut -d "." -f 1-3)
+VM_first_IP="${VM_first_IP}.${Host_last_IP_4}"
+
+echo "The VM IP Range will start from -> [$VM_first_IP]"
+jude="no"
+while [ $jude != "yes" -a $jude != "y" ];
+do
+    echo ""
+    echo "Input VM number/IP range in $1 (ex. 40)."
+    read -p "(If you have 10 PCs(4-core), suggestion is 30): " VM_IP_range
+    read -p "Is it correct? (yes/no): " jude
+done
+
+#echo "VM_first_IP=$VM_first_IP"
+#echo "VM_IP_range=$VM_IP_range"
+}
+
+function get_VM_prefix_name(){ 
+jude="no"
+while [ $jude != "yes" -a $jude != "y" ];
+do
+    echo ""
+    read -p "Input Prefix name for VM in $1 (ex. drblvm): " VM_prefix_name
+    read -p "Is it correct? (yes/no): " jude
+done
+#echo "VM_prefix_name=$VM_prefix_name"
+}
+
+function create_VM_IP_table(){
+#/etc/drbl-virt/etc/IP_VM_eth
+
+}
+
+
+
+
