Changeset 195 for drbl-virt/sbin


Ignore:
Timestamp:
Aug 29, 2010, 2:48:03 PM (14 years ago)
Author:
rock
Message:

Add function Code: check_drbl_client.sh (Detect DRBL clinet status)

Location:
drbl-virt/sbin
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • drbl-virt/sbin/drbl_PXE_PV-VM_create.sh

    r193 r195  
    1111# [Source]
    1212source /opt/drbl-virt/conf/drbl-virt.conf
    13 #source $Work_Path/functions_drbl_PXE_PV-VM_create
    14 source ./functions_drbl_PXE_PV-VM_create
     13source $Work_Path/functions_drbl_virt
     14#source ./functions_drbl_PXE_PV-VM_create
    1515
    1616
     
    2828echo "Usage: drbl_PXE_PV-VM_create.sh options"
    2929echo "Options: "
    30 echo "-v    vm name"
    31 echo "-c    cpu number"
    32 echo "-r    ram size"
    33 echo "-h    deploy vm to which host"
     30echo "-v|--vm      vm name"
     31echo "-c|--cpu     cpu number"
     32echo "-r|--ram     ram size"
     33echo "-h|--host    deploy vm to which host"
    3434echo "Examples: "
    3535echo "drbl_PXE_PV-VM_create.sh options -v drbl110 -c 2 -r 512 -h drbl101"
     
    4646while [ $# -gt 0 ]; do
    4747    case "$1" in
    48         -v)
     48        -v|--vm)
    4949            shift
    5050            if [ -z "$(echo $1 |grep ^-.)" ]; then
     
    5858            fi
    5959            ;;
    60         -c)
     60        -c|--cpu)
    6161            shift
    6262            if [ -z "$(echo $1 |grep ^-.)" ]; then
     
    7070            fi
    7171            ;;
    72         -r)
     72        -r|--ram)
    7373            shift
    7474            if [ -z "$(echo $1 |grep ^-.)" ]; then
     
    8282            fi
    8383            ;; 
    84         -h)
     84        -h|--host)
    8585            shift
    8686            if [ -z "$(echo $1 |grep ^-.)" ]; then
     
    138138fi
    139139
    140 vm_cfg=${vm_dir}/${vm_name}.cfg
     140vm_cfg=${vm_dir}/${vm_name}_PXE_PV-VM.cfg
    141141
    142142if [ -e $vm_cfg ]; then
  • drbl-virt/sbin/drbl_xen_repush.sh

    r190 r195  
    3030    cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak
    3131    cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /etc/drbl/IP_HOST_TABLE
     32    cp -f /etc/drbl/IP_HOST_TABLE.drbl-virt_bak /opt/drbl-virt/etc/IP_HOST_TABLE
    3233else
    3334    cp /etc/drbl/IP_HOST_TABLE /etc/drbl/IP_HOST_TABLE.drbl-virt_bak
     35    cp /etc/drbl/IP_HOST_TABLE /opt/drbl-virt/etc/IP_HOST_TABLE
    3436fi 
    3537
  • drbl-virt/sbin/functions_drbl_virt

    r190 r195  
    1616VMM_select=""
    1717
     18
    1819# [Check Root]
    1920function check_root(){     
     
    2425}
    2526
     27# [Change root to run]
    2628function check_root_run(){
    2729    if [ $USER != "root" ]; then
     
    4143}
    4244
     45
    4346# [Check System Version]
    4447function check_systemInfo(){
     
    4750Linux_Version=$(lsb_release -r | awk '{print $2}')
    4851}
     52
    4953
    5054# [Select Hypervisior(Xen/KVM)]
     
    7074}   
    7175
     76
    7277# [Check Hypervisior]
    7378function check_hypervisior(){
     
    140145
    141146
     147# [Tunning Debain env for Xen]
    142148function debain-lenny_xen_patch(){
    143149echo xen.independent_wallclock=1 >> /etc/sysctl.conf
     
    148154
    149155
     156# [Get ethX for DRBL environment usage ]
    150157function get_DRBL_eth(){
    151158eths=$(ls /etc/drbl | grep macadr-eth[0-9] | grep [0-9].txt$ | cut -d "-" -f2 | cut -d "." -f1)
     
    160167}
    161168
     169
     170# [Get DRBL client IP range]
    162171function get_Host_IP_range(){
    163172if [ ! -e /usr/bin/ipcalc ] || [ ! -e /opt/drbl/bin/drbl-get-network ] || [ ! -e /opt/drbl/bin/drbl-get-ipadd ]; then
     
    175184}
    176185
     186
     187# [Input VM IP range]
    177188function get_VM_IP_range_and_prefix_name(){
    178 
    179189echo ""
    180190echo "DRBL client IP range -> $eth: [$Host_first_IP ~ $Host_last_IP]"
     
    213223
    214224
     225# [Get VM prefix name]
    215226#function get_VM_prefix_name(){
    216227#jude="no"
     
    224235#}
    225236
     237
     238# [Create VM IP table]
    226239function create_VM_IP_table(){
    227240#/etc/drbl-virt/etc/IP_VM_eth
     
    271284}
    272285
     286
     287# [Creat VM Mac table]
    273288function generate_Xen_MAC_address(){
    274289#echo "eth $eth"
     
    312327}
    313328
     329
    314330#function add_VM_dhcpd_conf(){
    315331## backup dhcpd.conf
     
    353369
    354370
     371
     372# [create ssh key amd cpoy to client]
     373function drbl_sshkey(){
     374# The reasone we do not to use $HOME is that sudo will not change
     375# environmental variable $HOME, but it will change the $USER
     376# we need to know who is really running this after applying sudo.
     377# say, sudo echo "$HOME", it will show user's home, instead of root's home,
     378REALHOME=$(LC_ALL=C grep -Ew "^$USER" /etc/passwd | cut -d":" -f6)
     379drblroot="/tftpboot/nodes"
     380
     381if [ ! -f $REALHOME/.ssh/id_rsa ]; then
     382  ssh-keygen -t rsa -q -f $REALHOME/.ssh/id_rsa -N ""
     383fi
     384
     385# Put authorized_keys for the user. 2 cases:
     386# (1). It is root running drbl-doit.
     387# (2). It is normal user running drbl-doit.
     388# For root, we will NOT copy authorized_keys in server, since the root in the client should not share the same authorized_keys with that in server. We only put them in the client. (Note! Every client has its own root directory in $ihost/root/)
     389# For normal user, we let user can ssh login back to server and other machine without password (Note! This is NFS-based home, so we just have to copy id_rsa.pub as authorized_keys in user's home, then no matter which machine user logins, it will use this key).
     390if [ "$UID" = "0" ]; then
     391  # for root, copy id_rsa.pub as authorized_keys in clients.
     392  for ihost in $drblroot/*; do
     393    if [ -f "$REALHOME/.ssh/id_rsa.pub" ]; then
     394      mkdir -p $ihost/root/.ssh
     395      cp -af $REALHOME/.ssh/id_rsa.pub $ihost/root/.ssh/authorized_keys
     396    fi
     397  done
     398else
     399  if [ -f "$REALHOME/.ssh/id_rsa.pub" ]; then
     400    cp -af $REALHOME/.ssh/id_rsa.pub $REALHOME/.ssh/authorized_keys
     401  fi
     402fi
     403
     404}
Note: See TracChangeset for help on using the changeset viewer.