3 # cd in this command's directory
10 HDA=hdd-cow2-${DISK_SIZE}.img
11 QEMU_CREATE_IMAGE="qemu-img create -f qcow2 $HDA ${DISK_SIZE}"
14 TAP="tap,script=$SCRIPT"
16 ########## from the test environment
17 # expected vars are MACADDR, NODE_ISO, HOSTNAME, IP and TARGET_ARCH
19 [ -f "$CONFIG" ] || { echo "Config file for qemu $CONFIG not found in $(pwd)" ; exit 1 ; }
22 # the launcher, depending on local/target archs
23 # make sure to check qemu-kill-node for consistency
24 archs="$(uname -i)+$TARGET_ARCH"
26 i386+i386) QEMU=qemu;;
27 i386+x86_64) QEMU=qemu-system-x86_64;;
28 x86_64+i386) QEMU=qemu;;
29 x86_64+x86_64) QEMU=qemu-system-x86_64;;
32 echo "Running $COMMAND in $(pwd)"
33 echo "Starting at $(date)"
35 #Creating new HDA if needed only
36 #using qcow2 disk image format which is essential to support VM snapshots
38 echo "Using existing $HDA"
40 echo -n "Creating hard disk image (${DISK_SIZE}) as $HDA .. "
41 img=$($QEMU_CREATE_IMAGE)
51 #Command for running the Qemu Emulator
52 ARGS="-boot d -net nic,macaddr=${MACADDR} -net $TAP, -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM} -nographic -pidfile qemu.pid"
53 echo "Running $QEMU $ARGS < /dev/null"
54 exec $QEMU $ARGS < /dev/null