source: drbl-virt/sbin/drbl_xen_repush.sh @ 189

Last change on this file since 189 was 189, checked in by rock, 14 years ago

Bugfix:

  • Property svn:executable set to *
File size: 2.9 KB
RevLine 
[184]1#!/bin/bash
2# Program:
3#   Path DRBL evironment to support Xen/KVM
4# Author:
5#   Jazz, Rock {jazz, rock}@nchc.org.tw
6# Version:
7#    1.0
8# History:                                                                                         
9#   2010/07/20  Rock    First release (1.0)
10
11# [Source]
12source /opt/drbl-virt/conf/drbl-virt.conf
13source $Work_Path/functions_drbl_virt
14
15# [Main]
16
[185]17# = 1. Variables setup =
[184]18# == Get DRBL eth ==
19eths=""
20declare -i eth_nu=""
21get_DRBL_eth                                                                                                                                                                           
22     
23if [ $eth_nu -gt "1" ]; then
24    echo ""
25    echo "DRBL environment has muiltpule netwrok card(NIC)."
26fi   
27     
28for eth in $eths
29do   
30     
31    # == Get Host IP range/number  ==
32    Host_first_IP=""
33    Host_last_IP=""
34    # get eth network
35    eth_address=$(/opt/drbl/bin/drbl-get-ipadd $eth)
36    eth_netmask=$(/opt/drbl/bin/drbl-get-netmask $eth)
37    eth_network=$(/opt/drbl/bin/drbl-get-network $eth_address $eth_netmask)
38    get_Host_IP_range
39     
40    # == Get VM number, IP range & prefix name ==
41    declare -i VM_IP_range=""
42    declare -i Host_last_IP_4=""
43    declare -i VM_Host_totoal_nu=""
44    VM_first_IP=""
45    VM_last_IP=""
46    VM_prefix_name=""
47    get_VM_IP_range_and_prefix_name
48    create_VM_IP_table
49     
50    # == Generate MAC address  ==
51    # MAC address [00:16:3e:xx:xx:xx] is for Xen use
52    generate_Xen_MAC_address
53     
[185]54    # == Add VM IP to /etc/drbl/IP_HOST_TABLE  ==
[184]55    VM_IPs=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $1}')
[185]56    VM_IPs_nu=$(cat /opt/drbl-virt/etc/IP_VM_eth1 | awk '{print $1}' | wc -w)
[184]57    VM_hosts=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $2}')
58    VM_MACs=$(cat /opt/drbl-virt/etc/macadr-VM-$eth.txt)
[187]59
[189]60    #echo -e "VM_IPs=$VM_IPs \n VM_IPs_nu=$VM_IPs_nu \n VM_hosts=$VM_hosts \n VM_MACs=$VM_MACs"
[187]61
[185]62    # delete duplicating value(ip,hostname) in IP_HOST_TABLE
[189]63    #if [ -e /etc/drbl/IP_HOST_TABLE ]; then
64    #$Work_Path/duplicate_del /etc/drbl/IP_HOST_TABLE
65    #fi
[185]66    # add ip & hostname
[189]67    #$Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE $eth
[185]68   
[189]69    # == delete duplicating MAC ==
70   
[185]71    # == Add Mac address to macadr-ethX.txt ==
72    if [ -e /etc/drbl/macadr-$eth.txt ]; then
[189]73    delete_duplicating_MAC
[185]74    fi
[187]75    cat /opt/drbl-virt/etc/macadr-VM-$eth.txt >> /etc/drbl/macadr-$eth.txt
[184]76done 
77     
[185]78
79# = 2. Re-deploy drbl client =
80# == Cheange Xen Kernel ==   
[188]81Xen_Kernel=$(cat $Work_Home/etc/Xen_Kernel)
82read -p "Xen_Kernel=$Xen_Kernel"
[185]83echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel"
84/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel                                                                                                                       
85echo "" 
86# == Re-delpoy drbl client ==
87echo "Re-delpoy drbl client"           
88echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf"
89/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
90echo ""
Note: See TracBrowser for help on using the repository browser.