Changeset 189 for drbl-virt


Ignore:
Timestamp:
Aug 26, 2010, 8:42:04 PM (14 years ago)
Author:
rock
Message:

Bugfix:

Location:
drbl-virt/sbin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/drbl_xen_patch.sh

    r188 r189  
    4444declare -i modify_line=$(cat -n $generate_PXE_menu | grep 'label drbl' | awk 'NR==1 {print $1}')
    4545# delete default
    46 sed -i 's/^  MENU DEFAULT/  # MENU DEFAULT/d' $generate_PXE_menu
     46sed -i 's/^  MENU DEFAULT/  # MENU DEFAULT/g' $generate_PXE_menu
    4747# modify menu
    4848sed -i "${modify_line}i\label drbl-virt" $generate_PXE_menu
  • drbl-virt/sbin/drbl_xen_repush.sh

    r188 r189  
    5858    VM_MACs=$(cat /opt/drbl-virt/etc/macadr-VM-$eth.txt)
    5959
    60     echo -e "VM_IPs=$VM_IPs \n VM_IPs_nu=$VM_IPs_nu \n VM_hosts=$VM_hosts \n VM_MACs=$VM_MACs"
     60    #echo -e "VM_IPs=$VM_IPs \n VM_IPs_nu=$VM_IPs_nu \n VM_hosts=$VM_hosts \n VM_MACs=$VM_MACs"
    6161
    6262    # delete duplicating value(ip,hostname) in IP_HOST_TABLE
    63     if [ -e /etc/drbl/IP_HOST_TABLE ]; then
    64     $Work_Path/duplicate_del /etc/drbl/IP_HOST_TABLE
    65     fi
     63    #if [ -e /etc/drbl/IP_HOST_TABLE ]; then
     64    #$Work_Path/duplicate_del /etc/drbl/IP_HOST_TABLE
     65    #fi
    6666    # add ip & hostname
    67     $Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE $eth
     67    #$Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE $eth
     68   
     69    # == delete duplicating MAC ==
    6870   
    6971    # == Add Mac address to macadr-ethX.txt ==
    7072    if [ -e /etc/drbl/macadr-$eth.txt ]; then
    71     $Work_Path/duplicate_del_MAC /etc/drbl/macadr-$eth.txt
     73    delete_duplicating_MAC
    7274    fi
    7375    cat /opt/drbl-virt/etc/macadr-VM-$eth.txt >> /etc/drbl/macadr-$eth.txt
  • drbl-virt/sbin/duplicate_del_MAC

    r187 r189  
    1515cp $1 $1.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
    1616
     17read -p "debug $VM_MACs"
    1718# Delete duplating VM MAC
    1819for vm_mac in $(echo $VM_MACs)
  • drbl-virt/sbin/functions_drbl_virt

    r188 r189  
    292292
    293293# generate MAC
    294 for (( i=0 ; i<="$VM_Host_totoal_nu" ; i++ ))
     294for (( i=1 ; i<"$VM_Host_totoal_nu" ; i++ ))
    295295do
    296296    if [ $i -lt 10 ]; then
     
    325325#done
    326326#}
     327
     328function delete_duplicating_MAC(){
     329# backup
     330drbl_mac_file="/etc/drbl/macadr-$eth.txt"
     331cp $drbl_mac_file $drbl_mac_file.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
     332
     333read -p "debug $VM_MACs"
     334# Delete duplating VM MAC
     335for vm_mac in $(echo $VM_MACs)
     336do
     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
     350done
     351
     352
Note: See TracChangeset for help on using the changeset viewer.