added autostart-all and autostop-all
[public/kvm-scripts.git] / _run / common.sh
1 #!/bin/bash
2
3 IP=0.0.0.0
4 MONPORT=$(( 8500+${VMID} ))
5 VNCPORT=$(( ${VMID} ))
6 SERPORT=$(( 9900+${VMID} ))
7 TAP_NAME="kvm${VMID}"
8 PWD=$( pwd )
9
10 if [ -n "$DRIVE2" ] ; then
11         DRIVE2="-drive file=${DRIVE2},if=virtio,cache=none"
12 fi
13
14 if [ -n "$CORES" ] ; then
15         CORES="-smp cores=$CORES"
16
17 fi
18 if [ -n "$TABLET" ] ; then
19         TABLET="-usbdevice tablet"
20 fi
21
22 if [ -z "$VLAN" ] ; then
23     VLAN=0
24 fi
25 if [ ! -L _run/ifup_br${VLAN} ] ; then 
26     pushd _run
27     ln -s ifup_common ifup_br${VLAN}
28     popd
29 fi
30
31 if [ -z "MACADDR" ] ; then 
32     VLANDIGIT=$( echo 'ibase=10;obase=16;'$VLAN | bc)
33     VMDIGIT=$( echo 'ibase=10;obase=16;'$VMID | bc )
34     MACADDR="C0:FF:EE:19:$VLANDIGIT:$VMDIGIT"
35 fi