Changeset 190 for drbl-virt/sbin/functions_drbl_virt
- Timestamp:
- Aug 26, 2010, 10:45:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
drbl-virt/sbin/functions_drbl_virt
r189 r190 327 327 328 328 function delete_duplicating_MAC(){ 329 # backup330 329 drbl_mac_file="/etc/drbl/macadr-$eth.txt" 331 cp $drbl_mac_file $drbl_mac_file.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 332 333 read -p "debug $VM_MACs" 334 # Delete duplating VM MAC 335 for vm_mac in $(echo $VM_MACs) 336 do 337 vm_mac_lines=$(cat -n $drbl_mac_file | grep $vm_mac | awk '{print $1}' ) 338 read -p "DEBUG vm_mac_lines $vm_mac_lines" 339 # no duplicated vlaue, doesn't do it 340 if [ -n "$vm_mac_lines" ]; then 341 vm_mac_count=$(echo $vm_mac_lines | wc -w) 342 read -p "de vm_mac_count $vm_mac_count" 343 for (( i=1 ; i<=${vm_mac_count} ; i++ )) 344 do 345 del_line=$(echo $vm_mac_lines | cut -d " " -f${i}) 346 sed -i "${del_line}d" $drbl_mac_file 347 done 348 bash 349 fi 350 done 330 # if macadr-ethX.txt.drbl-virt_bak already have, backup it 331 # else cp default backup 332 if [ -e $drbl_mac_file.drbl-virt_bak ]; then 333 cp $drbl_mac_file $drbl_mac_file.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak 334 cp -f $drbl_mac_file.drbl-virt_bak $drbl_mac_file 335 else 336 cp $drbl_mac_file $drbl_mac_file.drbl-virt_bak 337 fi 338 339 # Delete duplating VM MAC 340 for vm_mac in $(echo $VM_MACs) 341 do 342 vm_mac_lines=$(cat -n $drbl_mac_file | grep $vm_mac | awk '{print $1}' ) 343 # no duplicated vlaue, doesn't do it 344 if [ -n "$vm_mac_lines" ]; then 345 vm_mac_count=$(echo $vm_mac_lines | wc -w) 346 for (( i=1 ; i<=${vm_mac_count} ; i++ )) 347 do 348 del_line=$(echo $vm_mac_lines | cut -d " " -f${i}) 349 sed -i "${del_line}d" $drbl_mac_file 350 done 351 fi 352 done 351 353 } 352 354
Note: See TracChangeset
for help on using the changeset viewer.