3 # Copyright (C) SUSE LINUX GmbH 2016, all rights reserved.
5 # This library is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published
7 # by the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) version 3.
10 # This library is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 # License for more details.
15 RAPIDO_DIR="`dirname $0`"
16 . "${RAPIDO_DIR}/runtime.vars"
18 [ -f "$DRACUT_OUT" ] \
19 || _fail "no initramfs image at ${DRACUT_OUT}. Run \"cut_X\" script?"
21 kernel_img="${KERNEL_SRC}/arch/x86/boot/bzImage"
22 [ -f "$kernel_img" ] \
23 || _fail "no kernel image present at ${kernel_img}. Build needed?"
25 [ -n "$MAC_ADDR1" ] || _fail "MAC_ADDR1 not configured in rapido.conf"
26 [ -n "$MAC_ADDR2" ] || _fail "MAC_ADDR2 not configured in rapido.conf"
30 # cut_ script may have specified some parameters for qemu (9p share)
31 qemu_cut_args="$(getfattr --only-values -n $QEMU_ARGS_XATTR $DRACUT_OUT \
33 qemu_more_args="$QEMU_EXTRA_ARGS $qemu_cut_args"
35 if [ "$IP_ADDR1_DHCP" = "1" ]; then
38 [ -n "$IP_ADDR1" ] || _fail "IP_ADDR1 not configured in rapido.conf"
39 kern_ip_addr1="${IP_ADDR1}:::255.255.255.0:${HOSTNAME1}"
42 pgrep -a qemu-system | grep -q mac=${MAC_ADDR1} && vm1_running=1
43 if [ -z "$vm1_running" ]; then
44 qemu-kvm -smp cpus=2 -m 512 \
45 -kernel "$kernel_img" \
46 -initrd "$DRACUT_OUT" \
47 -device e1000,netdev=nw1,mac=${MAC_ADDR1} \
48 -netdev tap,id=nw1,script=no,downscript=no,ifname=${TAP_DEV0} \
49 -append "ip=${kern_ip_addr1} rd.systemd.unit=emergency \
50 rd.shell=1 console=ttyS0 rd.lvm=0 rd.luks=0" \
55 if [ "$IP_ADDR2_DHCP" = "1" ]; then
58 [ -n "$IP_ADDR2" ] || _fail "IP_ADDR2 not configured in rapido.conf"
59 kern_ip_addr2="${IP_ADDR2}:::255.255.255.0:${HOSTNAME2}"
62 pgrep -a qemu-system | grep -q mac=${MAC_ADDR2} && vm2_running=1
63 if [ -z "$vm2_running" ]; then
64 qemu-kvm -smp cpus=2 -m 512 \
65 -kernel "$kernel_img" \
66 -initrd "$DRACUT_OUT" \
67 -device e1000,netdev=nw1,mac=${MAC_ADDR2} \
68 -netdev tap,id=nw1,script=no,downscript=no,ifname=${TAP_DEV1} \
69 -append "ip=${kern_ip_addr2} rd.systemd.unit=emergency \
70 rd.shell=1 console=ttyS0 rd.lvm=0 rd.luks=0" \