X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftemplate-qemu%2Fqemu-start-node;h=bef38de8186b9816d9334de8d500159c6edac8b9;hb=aec43105089dc65f0f0b32a19aabbd5e1cc58207;hp=7d327b1aa70d16da119286349caf5dcafa29f398;hpb=d42a371173899c719103e7354697c551c4ddbad1;p=tests.git diff --git a/system/template-qemu/qemu-start-node b/system/template-qemu/qemu-start-node index 7d327b1..bef38de 100755 --- a/system/template-qemu/qemu-start-node +++ b/system/template-qemu/qemu-start-node @@ -1,6 +1,8 @@ #!/bin/bash -# $Id$ +# Thierry Parmentelat +# Copyright (C) 2010 INRIA +# # it does the following: # (*) close all file descriptors and redirect output to log.txt # this is because it is designed for use through ssh from a remote test master controller @@ -12,9 +14,12 @@ COMMAND=$(basename $0) cd $(dirname $0) ########## globals -# 1 gigabyte ram -RAM=1024 -DISK_SIZE=18G +# use 2Gb to be safe now that we have a big infra +# 1Gb used to be anough up to f18 +# with f20 we went to 1.5 Gb +# with f21 1.5 Gb might be enough too, but we now have much more memory space so WTH +RAM=2048 +DISK_SIZE=100G DISK_FORMAT=qcow2 DISK_IMAGE=hdd-${DISK_FORMAT}-${DISK_SIZE}.img @@ -34,13 +39,28 @@ CONFIG=qemu.conf [ -f "$CONFIG" ] || { echo "Config file for qemu $CONFIG not found in $(pwd)" ; exit 1 ; } . $CONFIG +# NOTE: check if the machine supports 64bits. We'll add -no-kqemu only +# if it does. On 32bits host, qemu-system-x86_64 doesn't accept this +# parameter (although it's there in the man page) +function is_64bits () { + return $(cat /proc/cpuinfo | grep "^flags" | grep " lm " > /dev/null) +} + + # the launcher, depending on target arch # make sure to check qemu-kill-node for consistency -case $TARGET_ARCH in - i386) QEMU=qemu ; ARGS="" ;; - x86_64) QEMU=qemu-system-x86_64 ; ARGS="-no-kqemu" ;; - *) echo "Cannot handle TARGET_ARCH=$TARGET_ARCH"; exit 1 ;; -esac + +# use kvm if available +has_kvm=$(type -p qemu-kvm) +if [ -n "$has_kvm" ] ; then + QEMU="qemu-kvm" ; ARGS="" +else + case $TARGET_ARCH in + i386) QEMU=qemu ; ARGS="" ;; + x86_64) QEMU=qemu-system-x86_64 ; if is_64bits; then ARGS="-no-kqemu"; else ARGS=""; fi ;; + *) echo "Cannot handle TARGET_ARCH=$TARGET_ARCH"; exit 1 ;; + esac +fi echo "Running $COMMAND in $(pwd)" echo "Starting at $(date)" @@ -58,6 +78,13 @@ else echo "Done" fi +echo 'Trying to load the kqemu module' +if modprobe kqemu &> /dev/null ; then + echo "kqemu loaded" +else + echo "WARNING : Could not modprobe kqemu" +fi + echo 'Checking for a loaded kqemu module' lsmod | grep kqemu echo 'Checking for /dev/kqemu' @@ -74,9 +101,6 @@ ARGS="$ARGS -m ${RAM}" ARGS="$ARGS -hda ${DISK_IMAGE}" ARGS="$ARGS -nographic" ARGS="$ARGS -pidfile qemu.pid" -# how many pysical procs have we got, run in smp mode if possible -procs=$(grep -i mhz /proc/cpuinfo | wc -l ) -if (( $procs >= 2 )) ; then ARGS="$ARGS -smp 2" ; fi # boot from CD ARGS="$ARGS -boot d" ARGS="$ARGS -cdrom ${NODE_ISO}"