Changeset 213 for drbl-virt


Ignore:
Timestamp:
Oct 18, 2010, 3:31:18 PM (14 years ago)
Author:
rock
Message:

Add: support KVM (continue...)

Location:
drbl-virt/sbin
Files:
6 edited

Legend:

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

    r178 r213  
    11#!/bin/bash
    22# Program:
    3 #   Path DRBL evironment to support Xen/KVM
    4 # Author: 
     3#   Path DRBL evironment to support KVM
     4# Author:
    55#   Jazz, Rock {jazz, rock}@nchc.org.tw
    66# Version:
    77#    1.0
    8 # History:                                                                                         
    9 #   2010/07/20  Rock    First release (1.0)
     8# History:
     9#   2010/10/18  Rock    First release (1.0)
    1010
    1111# [Source]
     
    1414
    1515# [Main]
     16# = 1. Patch DRBL xen env for client =
     17# == Shutdown all drbl client ==
     18echo ""
     19echo "Please check all client are shutdown !!!"
     20echo "you can use /opt/drbl/sbin/dcs to shutdown."
     21read -p "Push [Enter] to continue......"
     22
     23# == check KVM Kernel version
     24check_kvm
     25
     26# == Modify PXE booting menu ==
     27# if menu doesn't has drbl-virt, then add it
     28cat /opt/drbl/sbin/generate-pxe-menu | grep "label drbl-virt" >> /dev/null
     29if [  $? != 0 ]; then
     30# backup generate-pxe-menu
     31cp /tftpboot/nbi_img/pxelinux.cfg/default /tftpboot/nbi_img/pxelinux.cfg/default.drbl-virt_bak
     32cp /opt/drbl/sbin/generate-pxe-menu /opt/drbl/sbin/generate-pxe-menu.drbl-virt_bak
     33
     34generate_PXE_menu="/opt/drbl/sbin/generate-pxe-menu"
     35declare -i modify_line=$(cat -n $generate_PXE_menu | grep 'label drbl' | awk 'NR==1 {print $1}')
     36# delete default
     37sed -i 's/^  MENU DEFAULT/  # MENU DEFAULT/g' $generate_PXE_menu
     38# modify menu
     39sed -i "${modify_line}i\label drbl-virt" $generate_PXE_menu
     40modify_line=$modify_line+1
     41sed -i "${modify_line}i\  MENU DEFAULT" $generate_PXE_menu
     42modify_line=$modify_line+1
     43sed -i "${modify_line}i\  # MENU HIDE" $generate_PXE_menu
     44modify_line=$modify_line+1
     45sed -i "${modify_line}i\  MENU LABEL DRBL-Virtualization ($KVM_Kernel)" $generate_PXE_menu
     46modify_line=$modify_line+1
     47sed -i "${modify_line}i\  kernel vmlinuz-pxe" $generate_PXE_menu
     48modify_line=$modify_line+1
     49sed -i "${modify_line}i\  append  initrd=initrd-pxe.img devfs=nomount drblthincli=off selinux=0 nomodeset"
     50modify_line=$modify_line+1
     51sed -i "${modify_line}i\  TEXT HELP" $generate_PXE_menu
     52modify_line=$modify_line+1
     53sed -i "${modify_line}i\  ENDTEXT" $generate_PXE_menu
     54modify_line=$modify_line+1
     55sed -i "${modify_line}i\ " $generate_PXE_menu
     56fi
    1657
    1758
     59# = 2. Patch DRBL initrd to support bridge =
     60# == Patch /usr/bin/mkpxeinitrd-net (1)Xen network scripts (2)command (3)modules ==
     61# backup mkpxeinitrd-net. if already has "drbl-virt add", dones't sed
     62source $Work_Path/drbl_bridge_patch.sh
    1863
    19 # [DRBL Environment Configuration]
    2064
     65# = 3. Load KVM module when booting =
     66if [ -e /etc/modules ]; then
     67    grep kvm /etc/modules
     68    if [ $? -eq 1 ]; then
     69       echo "kvm" >> /etc/modules
     70    fi
     71elif [ -e /etc/modules.conf ]
     72    grep kvm /etc/modules.conf
     73    if [ $? -eq 1 ]; then
     74        echo "kvm" >> /etc/modules.conf
     75    fi
     76fi
     77
     78# = 4. Copy xen kernel & initrd to /home/domains =
     79if [ ! -e /home/domains ]; then
     80    mkdir /home/domains
     81fi
     82cp /tftpboot/nbi_img/vmlinuz-pxe /home/domains
     83cp /tftpboot/nbi_img/initrd-pxe.img /home/domains
     84
     85
  • drbl-virt/sbin/drbl_virt.sh

    r207 r213  
    2020# = 1.[Install VMM/Hypervisior] 1=Xen, 2=KVM =
    2121if [ $VMM_select == 1 ]; then
     22    # install Xen
    2223    $Work_Path/xen_install.sh start
     24    # patch drbl to suuport Xen environment
     25    $Work_Path/drbl_xen_patch.sh
     26    # drbl re-push Xen environment
     27    $Work_Path/drbl_xen_repush.sh
    2328else
     29    # install KVM
    2430    $Work_Path/kvm_install.sh
     31    # patch drbl to suuport KVM environment
     32    $Work_Path/drbl_xen_patch.sh
     33    # drbl re-push KVM environment
    2534fi
    2635
    27 # = 2. Patch DRBL =                                                                                                               
    28 $Work_Path/drbl_xen_patch.sh
    29  
    30 # = 3. drbl_xen_repush.sh =
    31 $Work_Path/drbl_xen_repush.sh
    3236
    33 # = 4. Create User(drbl-virter) and mv drbl-virt.wat to tomcat =
     37# = 2. Create User(drbl-virter) and mv drbl-virt.wat to tomcat =
    3438#creat_drbl-virter
    3539#install_tomcat_and_mv_drbl-virt
  • drbl-virt/sbin/drbl_xen_patch.sh

    r210 r213  
    2020echo "Please check all client are shutdown !!!"
    2121echo "you can use /opt/drbl/sbin/dcs to shutdown."
    22 read -p "Push 'Enter' to continue......"
     22read -p "Push [Enter] to continue......"
    2323
    2424# == Change xen kernel for drbl client ==
  • drbl-virt/sbin/functions_drbl_virt

    r208 r213  
    436436echo "[Go to http://{server_IP}:8080/drbl-virt/ to check !]"
    437437}
     438
     439
     440# [Cehck KVM kernel & version]
     441function check_kvm(){
     442KVM_Kernel=$(uname -r)
     443}
     444
     445
  • drbl-virt/sbin/kvm_install.sh

    r175 r213  
    1616    # for Ubuntu
    1717    "Ubuntu")
    18         aptitude update ; aptitude install kvm
     18        echo "please check kernel (KVM enabled)" 
     19        echo "Push [Enetr] to install KVM package..."
     20        aptitude update ; aptitude install kvm bridge-utils
    1921    ;;
    2022    # for Debian
    2123    "Debian")
    22         aptitude update ; aptitude install kvm
     24        echo "please check kernel (KVM enabled)"
     25        echo "Push [Enetr] to install KVM package..."
     26        aptitude update ; aptitude install kvm bridge-utils
    2327    ;;
    2428    # for Fedora
    2529    "Fedora")       
    26         echo "Only support Debain & Debian"
     30        echo "Only support Debain."
     31        exit
    2732    ;;
    2833    *)
    29         echo "Only support Debain & Debian"
     34        echo "Only support Debain."
     35        exit
    3036    ;;
    3137esac
  • drbl-virt/sbin/xen_install.sh

    r202 r213  
    2121    "Ubuntu")
    2222        echo "Only support Debain"
     23        exit
    2324    ;;
    2425    # for Debian
     
    8081    "Fedora")           
    8182        echo "Only support Debain"
     83        exit
    8284    ;;
    8385    *)
    8486        echo "Only support Debain"
     87        exit
    8588    ;;
    8689esac
Note: See TracChangeset for help on using the changeset viewer.