fixed kill_qemus : uses qemu -pidfile for locating pids
[tests.git] / system / template-qemu / start-qemu-node
1 #!/bin/bash
2
3 # cd in this command's directory
4 cd $(dirname $0)
5
6 #Getting the env. as passed by the test framework - mostly MACADDR and NODE_ISO
7 CONFIG=start-qemu.conf
8 if [ ! -e ${CONFIG} ];then
9     echo "File for MAC Address not found"
10     exit 1
11 fi
12 . $CONFIG
13
14 #default Value
15 SCRIPT=./qemu-ifup
16 HDA=hda_10.raw
17 # make sure to check qemu_kill.sh if you change this
18 QEMU=qemu-system-x86_64
19
20 # qemu parameters
21 RAM=520;
22 TAP="tap,script=$SCRIPT";
23 #check for the creation of new HDA
24 if [ -e "$HDA" ]; then
25     echo "Disk already existing removing  it..."
26     rm -rf $HDA
27 fi
28
29 #Creating new HDA
30 echo "Creating hard disk for Qemu install under $HDA"
31
32 img=$(qemu-img create $HDA 10G)
33 if [ -z "$img" ];then
34         echo "Can't Create disk image..."
35         exit 1
36 fi
37
38 echo "New $HDA is created..."
39
40 #Command for running the Qemu Emulator
41 ARGS="-boot d -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM}  -net nic,macaddr=${MACADDR} -net $TAP -nographic -pidfile qemu.pid"
42 echo $$ > shell.pid
43 echo "Running qemu $ARGS"
44 $QEMU $ARGS
45
46
47 exit