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