Skip to content
Snippets Groups Projects
Commit 85551c88 authored by Florent Gluck's avatar Florent Gluck
Browse files

updated vm_run script to specifiy qcow or iso images and to boot first to cdrom if present

parent 91e1d945
Branches
No related tags found
No related merge requests found
......@@ -3,18 +3,54 @@
CPUS=4
RAM=4G
APP=`basename $0`
function echoerr {
echo "$@" >&2
}
if [ $# -ne 1 ]; then
appname=`basename $0`
echoerr "$appname - launch a QEMU VM on the specified disk image."
echoerr "The VM uses $CPUS CPUs and $RAM of RAM."
function usage {
echoerr "$APP - launch a VM on the specified disk image(s)."
echoerr "The VM is configured with $CPUS CPUs and $RAM of RAM."
echoerr ""
echoerr "Usage: $appname disk"
echoerr "Usage: $APP -d disk -c iso"
echoerr "disk the disk image to use (typically a .qcow file)"
echoerr "iso the CD/DVD-ROM image to use (typically an .iso file)"
echoerr ""
echoerr "At least one image must be specified."
exit 1
}
if [ $# -lt 1 ]; then
usage
fi
while [[ $# -gt 0 ]]; do
case $1 in
-d)
disk="$2"
shift # past argument
shift # past value
;;
-c)
iso="$2"
shift # past argument
shift # past value
;;
*)
echo "Unknown argument $1"
exit 1
;;
esac
done
if [ ! -z $disk ]; then
disk_drive="-drive file=$disk,index=0,media=disk,format=qcow2,if=virtio"
fi
if [ ! -z $iso ]; then
cdrom_drive="-drive file=$iso,index=1,media=cdrom,format=raw,read-only=on"
fi
qemu-system-x86_64 -enable-kvm -cpu host -smp cpus=$CPUS -m $RAM -drive file=$1,index=0,media=disk,format=qcow2,if=virtio -vga virtio -device virtio-serial-pci -nic user,model=virtio-net-pci
# -boot order=d tells QEMU to boot to CDROM first
qemu-system-x86_64 -enable-kvm -cpu host -smp cpus=$CPUS -m $RAM -boot order=d $disk_drive $cdrom_drive -vga virtio -device virtio-serial-pci -nic user,model=virtio-net-pci
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment