0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

KVM クローン作成スクリプト

Last updated at Posted at 2014-01-08
# !/bin/bash

function main(){

    local SRC_NAME=$1
    local DST_NAME=$2

    if [ -z ${SRC_NAME} ] || [ -z ${DST_NAME} ]
    then
        echo $0 [SRC_NAME]  [DST_NAME]
        exit 1
    fi

    clone_kvm ${SRC_NAME} ${DST_NAME}
    start_kvm ${DST_NAME}
}

function clone_kvm(){

    local SRC_NAME=$1
    local DST_NAME=$2

    virt-clone \
    --original ${SRC_NAME} \
    --name ${DST_NAME} \
    --file /var/lib/libvirt/images/${DST_NAME}.img \
    --prompt
}

function start_kvm {

    local DST_NAME=$1

    echo "virsh start ${DST_NAME}"

}
main ${@}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?