Changeset 199


Ignore:
Timestamp:
Aug 29, 2010, 9:42:09 PM (14 years ago)
Author:
rock
Message:

Add Function Code: Deploy vm to which host(drbl_PXE_PV-VM_deploy.sh)

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

Legend:

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

    r197 r199  
    4747done
    4848
    49 
     49# delete tmp file
     50rm -f $drbl_client_top_file
  • drbl-virt/sbin/check_drbl_vm.sh

    r198 r199  
    1616client_IPs=$(cat $Work_Home/etc/IP_HOST_TABLE | grep -v "#" | awk '{print $1}')
    1717drbl_vm_file="/tmp/drbl_vm_status.$$"
    18 
     18drbl_vm_xentop_file="/tmp/drbl_vm_xentop.$$"
    1919
    2020# [Main]
     
    2222do
    2323    # local variables
    24     drbl_vm_xentop_file="/tmp/drbl_vm_xentop.$client_IP.$$"
    2524    IP_status="online"
    2625    client_hostname="$(cat $Work_Home/etc/IP_HOST_TABLE | grep -v "#" | awk '{print $2}')"
     26    vm_numbers=""
    2727    vm_hostnames=""
    2828    vm_IP=""
     
    3838        vm_hostnames="$(cat $drbl_vm_xentop_file | sed -n '3,$p' | awk '{print $1}')"
    3939   
    40         printf "[$client_hostname]\n" >> $drbl_vm_file
    41         printf "[$client_hostname]\n"
     40        printf "[$client_hostname] " >> $drbl_vm_file
     41        printf "[$client_hostname] "
    4242        declare -i i=1
     43
     44        vm_numbers=$(echo vm_hostnames | wc -w)
     45       
     46        printf "[Running VM: $vm_numbers]\n" >> $drbl_vm_file
     47        printf "[Running VM: $vm_numbers]\n"
    4348
    4449        for vm_hostname in $vm_hostnames
     
    5661done
    5762
     63# dlete tmp file
     64rm -f $drbl_vm_xentop_file
  • drbl-virt/sbin/drbl_PXE_PV-VM_create.sh

    r195 r199  
    1818# = 1. Varibales declation =
    1919vm_name=""
    20 vm_cpu=""
    21 vm_ram=""
    22 vm_host=""
     20vm_cpu="1"
     21vm_ram="128"
     22#vm_host=""
    2323vm_mac=""
    2424
     
    2929echo "Options: "
    3030echo "-v|--vm      vm name"
    31 echo "-c|--cpu     cpu number"
    32 echo "-r|--ram     ram size"
    33 echo "-h|--host    deploy vm to which host"
     31echo "-c|--cpu     cpu number (default: 1)"
     32echo "-r|--ram     ram size(M) (default: 128)"
    3433echo "Examples: "
    35 echo "drbl_PXE_PV-VM_create.sh options -v drbl110 -c 2 -r 512 -h drbl101"
     34echo "drbl_PXE_PV-VM_create.sh options -v drbl131 -c 2 -r 512"
    3635}
    3736
     
    8281            fi
    8382            ;; 
    84         -h|--host)
    85             shift
    86             if [ -z "$(echo $1 |grep ^-.)" ]; then
    87                 if [ -n "$(echo $1)" ]; then
    88                 vm_host=$1
    89                 else
    90                     echo "-h host_value is null"
    91                     Usage && exit 2
    92                 fi
    93             shift
    94             fi
    95             ;;
     83#        -h|--host)
     84#            shift
     85#            if [ -z "$(echo $1 |grep ^-.)" ]; then
     86#                if [ -n "$(echo $1)" ]; then
     87#                vm_host=$1
     88#                else
     89#                    echo "-h host_value is null"
     90#                    Usage && exit 2
     91#                fi
     92#            shift
     93#            fi
     94#            ;;
    9695        -*)
    9796            echo "$0 $1 invalid option" >&2
     
    105104    esac
    106105done
     106
     107# check null value
     108[ -z $vm_name ] && echo "[Error] no VM name" && Usage && exit 2
    107109
    108110# = 2. Get VM MAC address =
Note: See TracChangeset for help on using the changeset viewer.