X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftemplate-qemu%2Fstart-qemu-node;h=377ff5fff06d77fad1ec8a75ab91c0d05a6afec6;hb=0f3d265dce4e160602b18727b1e668e467aa318b;hp=d3da9cf03a45d0d6df5c03c1988f79a462898403;hpb=b917cda18c6e89604d3e6e992f4de7bd9c314f00;p=tests.git diff --git a/system/template-qemu/start-qemu-node b/system/template-qemu/start-qemu-node index d3da9cf..377ff5f 100755 --- a/system/template-qemu/start-qemu-node +++ b/system/template-qemu/start-qemu-node @@ -4,41 +4,41 @@ cd $(dirname $0) #Getting the env. as passed by the test framework - mostly MACADDR and NODE_ISO -CONFIG=start-qemu.conf +CONFIG=qemu.conf if [ ! -e ${CONFIG} ];then - echo "File for MAC Address not found" + echo "File for node_iso version not found" exit 1 fi . $CONFIG #default Value -SCRIPT=./qemu-ifup -HDA=./hda_5.raw - -# qemu parameters -RAM=520; -TAP="tap,script=$SCRIPT"; -#check for the creation of new HDA -if [ -e "$HDA" ]; then - echo "Disk already existing removing it..." - rm -rf $HDA -fi - -#Creating new HDA -echo "Creating hard disk for Qemu install under $HDA" - -img=$(qemu-img create $HDA 10G) -if [ -z "$img" ];then +#always use the 64 bit version of qemu, as this will work on both 32 & 64 bit host kernels +QEMU=qemu +HDA=hda_5.img +RAM=1024 + +SCRIPT=qemu-ifup +TAP="tap,script=$SCRIPT" + +#Creating new HDA if needed only +#using qcow2 disk image format which is essential to support VM snapshots +if [ -f $HDA ] ; then + echo "Using $HDA" +else + echo "Creating hard disk for Qemu install under $HDA" + img=$(qemu-img create -f qcow2 $HDA 5G) + if [ -z "$img" ];then echo "Can't Create disk image..." exit 1 + fi fi echo "New $HDA is created..." -#Command for running the Qemu Emulator -ARGS="-boot d -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM} -net nic,macaddr=${MACADDR} -net $TAP -nographic -kernel-kqemu"; -echo "Running qemu $ARGS"; -qemu-system-x86_64 $ARGS - +rm -f qemu.pid -exit +#Command for running the Qemu Emulator +ARGS="-boot d -net nic,macaddr=${MACADDR} -net $TAP, -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM} -nographic -pidfile qemu.pid" +echo $$ > shell.pid +echo "Running $QEMU $ARGS < /dev/null" +exec $QEMU $ARGS < /dev/null