# qemukvm.include # # Copyright (c) 2009 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING # # If you have any feedback please consult http://openslx.org/feedback and # send your feedback to feedback@openslx.org # # General information about OpenSLX can be found at http://openslx.org # # Include script for running the QEMU/Linux KVM virtual machine on an OpenSLX # client via the run-virt.sh. The stuff is copied to /etc/opt/openslx/run- # qemukvm.include during stage3. # include general configuration from vmchooser . /etc/opt/openslx/run-virt.include permem=50 mem=$(expr ${totalmem} / 100 \* ${permem}) VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}" # network adaptor alternatives: rtl8139, pcnet, e1000 VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,model=pcnet" case "${network_kind}" in bridge*) VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap0" ;; nat|NAT) VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap1" ;; hostonly) VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tap2" ;; esac # virtual fd/cd/dvd and drive devices, floppy b: for configuration #VIRTCMDOPTS="${VIRTCMDOPTS} -fda /dev/fd0" VIRTCMDOPTS="${VIRTCMDOPTS} -fdb /var/lib/virt/vmchooser/loopimg/fd.img" # if $floppy_0 from run-virt.include set then fdtest="TRUE" fdtest= fdtest=${floppy_0:+"TRUE"} # if $fdtest not set floppy0="FALSE", else "TRUE" floppy0=${fdtest:-"FALSE"} floppy1="TRUE" floppy1name="/var/lib/virt/vmchooser/loopimg/fd.img" # if $cdrom_0 from run-virt.include set then cdtest="TRUE" cdtest= cdtest=${cdrom_0:+"TRUE"} # if $cdtest not set cdrom0="FALSE", else "TRUE" cdrom0=${cdtest:-"FALSE"} # if $cdrom_1 from run-virt.include set then cdtest="TRUE" cdtest= cdtest=${cdrom_1:+"TRUE"} # if $cdtest not set cdrom1="FALSE", else "TRUE" cdrom1=${cdtest:-"FALSE"} # ide is expected default, test for the virtual disk image type should # be done while creating the runscripts ... ide="TRUE" hddrv="ide" # audio VIRTCMDOPTS="${VIRTCMDOPTS} -soundhw all" # serial #VIRTCMDOPTS="${VIRTCMDOPTS} -serial /dev/ttyS0" # set the variables appropriately for tool in kvm qemu-kvm qemu; do VIRTCMD=$(which ${tool} 2>/dev/null) [ "x$VIRTCMD" != "x" ] && break done [ -z $VIRTCMD ] && { writelog "No qemu/kvm tool found."; exit 1; } VIRTCMD="sudo $VIRTCMD" VIRTCMDOPTS="${VIRTCMDOPTS} -boot c -alt-grab ${diskfile}"