zoukankan      html  css  js  c++  java
  • xenserver 通过模板快速创建VM

    #/bin/sh
    
    #this script for Faster cloune on xenserver 7
    #send vm-create.sh to xenserver use ftp or ssh first  ./vm-create.sh
    #version: 0.03
    #date:  2016-12-29
    #yelang007sheng@163.com
    
    
    #select template
    s_template(){
    
        templates=`xe template-list live=true |grep name-label |awk -F: '{print $2}' |sed s'/ //'`
      #xenserver6.5 live=false
        templates=`echo $templates`
    
        for((;;))
        do
    
            read -p "Template[ $templates ]: " template
            xe template-list live=true |grep "<$template>"
            flag=$?
            if [ $flag -ne 0 ];then
                echo "Input Error"
                continue
            else
                break
            fi
        done
    }
    
    # select clone type
    s_clone_type(){
    
        for((;;))
        do
            read -p "Clone [1=Full Clone; 2=Faster Clone]: " clone
            if [ $clone -eq 1 ]; then
                break
            elif [ $clone -eq 2 ];then
                break
            else
                echo "Input Error: Please input 1 or 2"
                continue
            fi
        
        done
    }
    
    #start .....
    
    
    #2. input vm name:
    read -p "VM Name: " name
    
    #3. input vm number:
    
    for((;;))
    do
        read -p "VM Count: " count
        if [ $count -gt 0 ] 2>/dev/null; then
            break
        else
            echo "Input Error,Please input a number!"
            continue
        fi
    done
    
    #4. select template
    s_template
    
    #5. select clone type
    s_clone_type
    
    #6. install vm
    for((i=1;i<=$count;i++))
    do
        if [ $clone -eq 1 ];then
            xe vm-install template=$template sr-name-label="Local storage" new-name-label="$name$i"    
            sleep 1    
        else
            xe vm-install template=$template new-name-label="$name$i"              
            sleep 1    
        fi
    done
  • 相关阅读:
    iOS 网络NSURLConnection
    iOS RunLoop
    iOS 多线程及其他补充 02
    iOS 多线程 01
    iOS UI进阶06
    iOS UI进阶05
    ios 调试命令(oc用”po self“,swift用“frame variable self”)
    ios 视频编辑,添加文字、图片(CA动画)水印,合成视频
    ios 添加openssl库
    ios 动效收集
  • 原文地址:https://www.cnblogs.com/hayden1106/p/8005378.html
Copyright © 2011-2022 走看看