Changeset 171


Ignore:
Timestamp:
Aug 10, 2010, 4:00:31 PM (14 years ago)
Author:
rock
Message:

Add: DRBL patch for Xen

Location:
drbl-virt
Files:
1 added
2 edited
1 copied
4 moved

Legend:

Unmodified
Added
Removed
  • drbl-virt/install.sh

    r162 r171  
    1212Work_Home="/opt/drbl-virt"
    1313Work_Path="/opt/drbl-virt/sbin"
    14 Now_path="pwd $0"
     14Now_Path="$(dirname $0)"
    1515PATH=${PATH}:$Work_Path
    1616
    1717# [Source]
    18 source funs_drbl_virt
     18source $Now_Path/sbin/functions_drbl_virt
    1919
    2020# [Main]
     
    2323
    2424mkdir -p $Work_Home
    25 cp -r $Now_path/sbin $Work_Path/
    26 cp -r $Now_path/conf $Work_Path/
    27 
     25cp -fr $Now_Path/sbin $Work_Home/
     26cp -fr $Now_Path/conf $Work_Home/
     27cp  -fr $Now_Path/uninstall.sh $Work_Home/
  • drbl-virt/sbin/drbl_kvm_patch.sh

    r161 r171  
    99#   2010/07/20  Rock    First release (1.0)
    1010
    11 # [PATH]
    12 #Work_Path=$(dirname "$0")
    13 #PATH=${PATH}:$Work_Path
    14 
    1511# [Source]
    16 #source funs_drbl_virt
    17 
     12source functions_drbl_virt
     13source /opt/drbl-virt/conf/drbl-virt.conf
    1814# [Main]
    1915
    20 # [Install VMM/Hypervisior]
    21 if [ $VMM_select == 1 ]; then
    22     source xen_intall.sh
    23 else
    24     source kvm_intall.sh
    25 fi
    2616
    2717# [DRBL Environment Configuration]
  • drbl-virt/sbin/drbl_virt.sh

    r161 r171  
    99#   2010/07/20  Rock    First release (1.0)
    1010
    11 # [PATH]
    12 Work_Home="/opt/drbl-virt"
    13 Work_Path="/opt/drbl-virt/sbin"
    14 PATH=${PATH}:$Work_Path
    15 
    1611# [Source]
    17 source funs_drbl_virt
    18 
     12source /opt/drbl-virt/conf/drbl-virt.conf
     13source /opt/drbl-virt/sbin/functions_drbl_virt
    1914# [Main]
    2015install_drbl-virt_dir
     
    2217check_systemInfo
    2318VMM_select
     19#check_root
    2420
    2521# [Install VMM/Hypervisior] 1=Xen, 2=KVM
    2622if [ $VMM_select == 1 ]; then
    27     source xen_intall.sh
     23    source xen_install.sh
    2824else
    29     source kvm_intall.sh
     25    source kvm_install.sh
    3026fi
    3127
  • drbl-virt/sbin/drbl_xen_patch.sh

    r161 r171  
    99#   2010/07/20  Rock    First release (1.0)
    1010
    11 # [PATH]
    12 #Work_Path=$(dirname "$0")
    13 #PATH=${PATH}:$Work_Path
    14 
    1511# [Source]
    16 #source funs_drbl_virt
     12source functions_drbl_virt
     13source /opt/drbl-virt/conf/drbl-virt.conf
    1714
    1815# [Main]
    1916
    20 # [Install VMM/Hypervisior]
    21 if [ $VMM_select == 1 ]; then
    22     source xen_intall.sh
    23 else
    24     source kvm_intall.sh
    25 fi
     17# = 1. Patch DRBL xen env for client =
     18# == Shutdown all drbl client ==
     19echo "Please check all client are shutdown !!!"
     20read -p "Push 'Enter' to continue......"
    2621
    27 # [DRBL Environment Configuration]
     22# == Change xen kernel for drbl client ==
     23check_xen_nu
     24Xen_Kernel=$(echo $Xen_Kernel | sed 's/^vmlinuz-//g' )
     25echo "/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel"
     26#/opt/drbl/sbin/drblsrv-offline -s $Xen_Kernel
     27echo ""
    2828
     29# == Re-delpoy drbl client ==
     30echo "Re-delpoy drbl client"
     31echo "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf"
     32#/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
     33echo ""
     34
     35# == Copy xen image to /tftpboot/nbi_img/ ==
     36echo "copy Xen image & Kernel to /tftpboot/nbi_img/"
     37cp /boot/*xen* /tftpboot/nbi_img/
     38cp /boot/vmlinuz-${Xen_Kernel} /tftpboot/nbi_img/
     39cp /boot/initrd.img-${Xen_Kernel} /tftpboot/nbi_img/
     40cp /boot/config-${Xen_Kernel} /tftpboot/nbi_img/
     41echo ""
     42
     43# == Modify PXE booting menu ==
     44# backup
     45cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak
     46
     47
     48# = 2. Patch DRBL initrd to support bridge =
     49# == Patch /usr/bin/mkpxeinitrd-net (1)modules (2)xen network scripts ==
     50
     51# == Copy xen netwrok scripts ==
     52
     53# == run xen network scripts (/usr/lib/mkpxeinitrd-net/initrd-skel/linuxrc-or-init) ==
     54
     55
     56
  • drbl-virt/sbin/functions_drbl_virt

    r161 r171  
    1919function check_root(){     
    2020  if [ $USER != "root" ]; then
    21     echo -e "Please input root password to run it!"
    22     su -c "$0" "$@"                   
    23 
     21    echo -e "Please change root to run it!"
     22    exit
    2423  fi
    2524}
     25
     26function check_root_run(){
     27    if [ $USER != "root" ]; then
     28    echo -e "Please change root to run it!"
     29    sudo su -c ~/"$0" "$@"
     30    exit
     31fi
     32}
     33
    2634
    2735# [Check CPU support]
     
    4048}
    4149
    42 
     50# [Select Hypervisior(Xen/KVM)]
    4351function VMM_select(){
    4452if [ $cpu_flag == "yes" ]; then
     
    4755       read -p "Which VMM/Hypervisior will be used in DRBL (1)Xen (2)KVM: " VMM_select
    4856    done
    49     echo "Xen" > $Work_Home/.tmp/hypervisior
     57  if [ $VMM_select == "1"  ]; then
     58    echo "Xen" > $Work_Home/.tmp/hypervisior
     59  else
     60    echo "KVM" > $Work_Home/.tmp/hypervisior
     61  fi 
    5062else
    5163    echo "Xen will be the only Hypervisior in your DRBL"
    52     echo -e "Because CPU don't support virtualization, \nit can't choose KVM to be the Hypervisior"
    53     VMM_select=2
    54     echo "KVM" > $Work_Home/.tmp/hypervisior
     64    echo -e "Because CPU don't support virtualization, it can't choose KVM to be the Hypervisior"
     65    echo ""
     66    VMM_select=1
     67    echo "Xen" > $Work_Home/.tmp/hypervisior
    5568fi 
    5669}   
    5770
    58 # [create drbl-virt path]
     71
     72# [Create drbl-virt path]
    5973function install_drbl-virt_dir(){
    6074    mkdir -p $Work_Home/.tmp
    6175}
    6276
    63 # [check Hypervisior]
     77
     78# [Check Hypervisior]
    6479function check_hypervisior(){
    65     return $(cat $Work_Home/.tmp/hypervisior)
     80    hypervisior=$(cat $Work_Home/.tmp/hypervisior)   
     81}
     82
     83
     84# [Check Debian Xen package]
     85function check_debian_xen(){
     86aptitude update
     87check_debian_xen_pkg=$(aptitude search xen-linux-system)
     88if [ -n $check_debian_xen_pkg  ]; then
     89    check_debian_xen_pkg="yes"
     90else
     91    check_debian_xen_pkg="no"
     92fi
     93}
     94
     95
     96# [Check Xen kernel]
     97function check_xen_nu(){
     98Kernels=$(ls /boot | grep vmlinuz)
     99Kernel_choose=""
     100jude="no"
     101
     102while [ $jude != "yes" -a $jude != "y" ]
     103do
     104    declare -i i=1
     105    echo ""
     106   
     107    for Kernel in $Kernels
     108    do
     109        echo "($i) $Kernel"
     110        i=i+1
     111    done
     112
     113    read -p "Xen Kenrel is (1/2/...): " Kernel_choose
     114    read -p "Are you sure (yes/no): " jude
     115done
     116
     117Xen_Kernel=$(echo $Kernels | cut -d " " -f${Kernel_choose})
     118#echo "debug: Xen_Kernel=$Xen_Kernel"
    66119}
    67120
    68121# [DRBL Check]
    69122
     123
     124
  • drbl-virt/uninstall.sh

    r161 r171  
    1010
    1111# [PATH]
    12 Work_Path=$(dirname "$0")
     12Work_Home="/opt/drbl-virt"
     13Work_Path="/opt/drbl-virt/sbin"
     14Now_Path="$(dirname $0)"
    1315PATH=${PATH}:$Work_Path
    1416
    1517# [Source]
    16 source funs_drbl_virt
    17 
     18source $Now_Path/sbin/functions_drbl_virt
    1819# [Main]
    1920check_systemInfo
     21checkroot
    2022
    2123case $Linux_Distribution in
     
    5456esac
    5557
     58cd
     59rm -fr $Work_Home
Note: See TracChangeset for help on using the changeset viewer.