Changeset 182
- Timestamp:
- Aug 20, 2010, 10:29:05 AM (14 years ago)
- Location:
- drbl-virt/sbin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
drbl-virt/sbin/drbl_PXE_PV-VM_deploy.sh
r181 r182 32 32 Host_last_IP="" 33 33 get_Host_IP_range 34 # == Get VM number & IP range==34 # == Get VM number, IP range & prefix name == 35 35 declare -i VM_IP_range="" 36 36 declare -i Host_last_IP_4="" 37 37 VM_first_IP="" 38 38 VM_last_IP="" 39 get_VM_IP_range40 # == Get VM IP prefix hostname ==41 39 VM_prefix_name="" 42 get_VM_ prefix_name43 40 get_VM_IP_range_and_prefix_name 41 create_VM_IP_table 44 42 45 43 done -
drbl-virt/sbin/functions_drbl_virt
r181 r182 158 158 function get_DRBL_eth(){ 159 159 eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt$ | cut -d "-" -f2 | cut -d "." -f1) 160 eths_nu=$(echo $eths | wc -l) 161 160 eths_nu=$(echo $eths | wc -w) 161 162 if [ $eths_nu -gt 1 ]; then 163 echo "" 164 echo "There are multiple eth for DRBL environment: " 165 echo "$eths" 166 fi 162 167 163 168 } … … 181 186 } 182 187 183 function get_VM_IP_range(){ 188 function get_VM_IP_range_and_prefix_name(){ 189 184 190 echo "" 185 echo "DRBL client IP range -> $eth [$Host_first_IP ~ $Host_last_IP]"186 187 declare -iHost_last_IP_4=$(echo $Host_last_IP | cut -d "." -f4)191 echo "DRBL client IP range -> $eth: [$Host_first_IP ~ $Host_last_IP]" 192 193 Host_last_IP_4=$(echo $Host_last_IP | cut -d "." -f4) 188 194 Host_last_IP_4=$(($Host_last_IP_4+1)) 189 195 VM_first_IP=$(echo $Host_last_IP | cut -d "." -f 1-3) … … 195 201 do 196 202 echo "" 197 echo "Input VM number/IP range in $eth (ex. 40)." 198 read -p "(If you have 10 PCs(4-core), suggestion is 30): " VM_IP_range 203 echo "Input VM number/IP range for $eth (ex. 40)." 204 205 jude_2="no" 206 while [ $jude_2 != "yes" -a $jude_2 != "y" ] 207 do 208 jude_2="yes" 209 read -p "(If you have 10 PCs(4-core), suggestion is 30): " VM_IP_range 210 if [ $((${VM_IP_range}+${Host_last_IP_4})) -ge 254 ]; then 211 echo "range can't greater than 254" 212 jude_2="no" 213 fi 214 done 215 216 read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name 199 217 read -p "Is it correct? (yes/no): " jude 200 218 done … … 204 222 } 205 223 206 function get_VM_prefix_name(){207 jude="no"208 while [ $jude != "yes" -a $jude != "y" ];209 do210 echo ""211 read -p "Input Prefix name for VM in$eth (ex. drblvm): " VM_prefix_name212 read -p "Is it correct? (yes/no): " jude213 done224 #function get_VM_prefix_name(){ 225 #jude="no" 226 #while [ $jude != "yes" -a $jude != "y" ]; 227 #do 228 # echo "" 229 # read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name 230 # read -p "Is it correct? (yes/no): " jude 231 #done 214 232 #echo "VM_prefix_name=$VM_prefix_name" 215 }233 #} 216 234 217 235 function create_VM_IP_table(){ … … 230 248 # 2 bit 231 249 if [ $VM_Host_totoal_nu -lt 100 ]; then 232 for (( i=$Host_last_IP_4 ; i<="$VM_ IP_range" ; i++ ))250 for (( i=$Host_last_IP_4 ; i<="$VM_Host_totoal_nu" ; i++ )) 233 251 do 234 252 if [ $i -lt 10 ]; then … … 238 256 else 239 257 VM_IP_1=$i 240 echo "${eth_network_f3}.$VM_IP_1 ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$et 258 echo "${eth_network_f3}.$VM_IP_1 ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$eth 241 259 fi 242 260 done 243 261 # 3 bit 244 262 elif [ $VM_Host_totoal_nu -ge 100 ] && [ $VM_Host_totoal_nu -lt 254 ]; then 245 for (( i=$Host_last_IP_4 ; i<=$VM_ IP_range; i++ ))263 for (( i=$Host_last_IP_4 ; i<=$VM_Host_totoal_nu ; i++ )) 246 264 do 247 265 if [ $i -lt 10 ]; then
Note: See TracChangeset
for help on using the changeset viewer.