Changeset 184 for drbl-virt/sbin/functions_drbl_virt
- Timestamp:
- Aug 26, 2010, 2:14:50 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
drbl-virt/sbin/functions_drbl_virt
r183 r184 174 174 fi 175 175 176 # get eth network 177 eth_address=$(/opt/drbl/bin/drbl-get-ipadd $eth) 178 eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $eth) 179 eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask) 176 # get eth network X.X.X 180 177 eth_network_f3=$(echo $eth_network | cut -d "." -f 1-3) 181 178 … … 214 211 done 215 212 216 read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name 213 #read -p "Input Prefix name for VM for $eth (ex. drblvm): " VM_prefix_name 214 VM_prefix_name=$(cat /etc/drbl/drblpush.conf | grep hostname= | sed 's/hostname=//') 217 215 read -p "Is it correct? (yes/no): " jude 218 216 done … … 238 236 VM_Host_totoal_nu=$((${Host_last_IP_4}-1+${VM_IP_range})) 239 237 if [ -e /opt/drbl-virt/etc/IP_VM_$eth ]; then 240 mv /opt/drbl-virt/etc/IP_VM_$eth /opt/drbl-virt/etc/IP_VM_${eth}.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak238 mv -f /opt/drbl-virt/etc/IP_VM_$eth /opt/drbl-virt/etc/IP_VM_${eth}.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 241 239 fi 242 240 declare -i VM_IP_0=$VM_prefix_eth … … 275 273 echo "${eth_network_f3}.${VM_IP_1} ${VM_prefix_name}${VM_IP_0}${VM_IP_1}" >> /opt/drbl-virt/etc/IP_VM_$eth 276 274 fi 277 278 275 done 279 276 … … 297 294 298 295 # backup 299 mv /opt/drbl-virt/etc/macadr-VM-$eth.txt /opt/drbl-virt/etc/macadr-VM-$eth.txt.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak296 mv -f /opt/drbl-virt/etc/macadr-VM-$eth.txt /opt/drbl-virt/etc/macadr-VM-$eth.txt.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 300 297 301 298 # generate MAC … … 318 315 fi 319 316 done 320 321 322 } 323 324 317 } 318 319 function add_VM_dhcpd_conf(){ 320 # backup dhcpd.conf 321 if [ -e /etc/dhcp3/dhcpd.conf ]; then 322 cp -f /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.drbl-virt_bak 323 fi 324 325 subnet_lines=$(cat -n /etc/dhcp3/dhcpd.conf | grep $eth_network | awk '{print $1}') 326 host_lines=$(cat -n /etc/dhcp3/dhcpd.conf | grep 'host ' | grep '{' | awk '{print $1}') 327 328 for subnet_line in $subnet_lines 329 do 330 host_lines cat -n /etc/dhcp3/dhcpd.conf | sed -n "$subnet_line,\$p" | grep 'host .* {' | awk '{print $1}' 331 332 done 333 334 }
Note: See TracChangeset
for help on using the changeset viewer.