-
-
Save jjasghar/e9c321116717be0dd08a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# exit on any error | |
set -o errexit | |
# A few tunable variables | |
NAME='atomic' | |
NAME='try' | |
#NAME='test' | |
#DISK='/guests/rhel-guest-image-7.1-20150224.0.x86_64.qcow2' | |
DISK='/guests/rhel-atomic-cloud-7.1-1.x86_64.qcow2' | |
DISK='/guests/try.raw' | |
SEEDISO='/guests/my-seed.iso' | |
RAMSIZE='2048' # IN MB | |
DISKSIZE='20' # IN GB | |
VCPUS='2' # NUM of CPUs | |
IMAGEDIR='/guests/' | |
BRIDGE='virbr0' | |
TMPDISK=${DISK}${RANDOM} | |
echo "Creating backup disk $TMPDISK" | |
qemu-img create -f qcow2 -b $DISK $TMPDISK 10G | |
# Build up the virt-install command | |
cmd='virt-install --import' | |
cmd+=" --name $NAME" | |
cmd+=" --ram $RAMSIZE" | |
cmd+=" --vcpus $VCPUS" | |
cmd+=" --disk path=$TMPDISK" | |
cmd+=" --disk path=$SEEDISO" | |
cmd+=" --accelerate" | |
cmd+=" --graphics none" | |
cmd+=" --force" | |
cmd+=" --network bridge=$BRIDGE" | |
# Run the command | |
echo "Running: $cmd" | |
$cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment