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

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

Modify: the same

  • Property svn:executable set to *
File size: 2.7 KB
Line 
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
17# = 1. Variables setup =
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     
54    # == Add VM IP to /etc/drbl/IP_HOST_TABLE  ==
55    VM_IPs=$(cat /opt/drbl-virt/etc/IP_VM_$eth | awk '{print $1}')
56    VM_IPs_nu=$(cat /opt/drbl-virt/etc/IP_VM_eth1 | awk '{print $1}' | wc -w)
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)
59    # delete duplicating value(ip,hostname) in IP_HOST_TABLE
60    if [ -e /etc/drbl/IP_HOST_TABLE ]; then
61    $Work_Path/duplicate_del /etc/drbl/IP_HOST_TABLE
62    fi
63    # add ip & hostname
64    $Work_Path/add_value /opt/drbl-virt/etc/IP_VM_$eth /etc/drbl/IP_HOST_TABLE
65   
66    # == Add Mac address to macadr-ethX.txt ==
67    if [ -e /etc/drbl/macadr-$eth.txt ]; then
68    $Work_Path/duplicate_del_MAC /etc/drbl/macadr-$eth.txt
69    fi
70
71done 
72     
73
74# = 2. Re-deploy drbl client =
75# == Cheange Xen Kernel ==   
76echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel"
77/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel                                                                                                                       
78echo "" 
79# == Re-delpoy drbl client ==
80echo "Re-delpoy drbl client"           
81echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf"
82/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
83echo ""
Note: See TracBrowser for help on using the repository browser.