From 83050d1233afbd5417a586eefb39b6f8dd210bbe Mon Sep 17 00:00:00 2001 From: Yonghee Han Date: Tue, 20 Mar 2018 18:40:37 +0900 Subject: [PATCH] Enable networking inside VM. Add the following to configuration for the Networking VM_WORKER,VM_WORKER_NR,VM_NETDEVOPT,VM_DEVICEOPT How to use Modify the /etc/sysconfig/obs-server on OBS Worker OBS_VM_NETDEVOPT=user,id=user.0 OBS_VM_DEVICEOPT=e1000,netdev=user.0 Related obs-server-2.7 Change-Id: Ie519b7c81ed185845f71a1a130c995f0a9134b2c --- build | 10 ++++++++++ build-vm | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/build b/build index ea0f113..6a7599d 100755 --- a/build +++ b/build @@ -1327,6 +1327,16 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do ifconfig ${VM_TELNET_DEVICE} add ::1/24 fi fi + if test -n "$VM_NETDEVOPT"; then + let LASTIP="${VM_WORKER_NR:-0}"+10 + if test -x /sbin/ip ; then + ip addr add 10.0.2.$LASTIP/24 dev eth0 + ip link set eth0 up + else + ifconfig eth0 10.0.2.$LASTIP netmask 255.255.255.0 up + fi + route add default gw 10.0.2.2 eth0 + fi if test -n "$MYHOSTNAME" ; then hostname "$MYHOSTNAME" fi diff --git a/build-vm b/build-vm index 543f69f..66c3c55 100644 --- a/build-vm +++ b/build-vm @@ -744,6 +744,10 @@ vm_first_stage() { echo "DO_INIT_TOPDIR='${DO_INIT_TOPDIR//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data echo "KIWI_PARAMETERS='${KIWI_PARAMETERS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data echo "VM_TELNET='${VM_TELNET//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data + echo "VM_WORKER='${VM_WORKER}'" >> $BUILD_ROOT/.build/build.data + echo "VM_WORKER_NR='${VM_WORKER_NR}'" >> $BUILD_ROOT/.build/build.data + echo "VM_NETDEVOPT='${VM_NETDEVOPT}'" >> $BUILD_ROOT/.build/build.data + echo "VM_DEVICEOPT='${VM_DEVICEOPT}'" >> $BUILD_ROOT/.build/build.data echo "VM_CONSOLE_INPUT='${VM_CONSOLE_INPUT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data test -n "$VM_SWAP" && echo "VM_SWAP='${VM_SWAPDEV//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data test -n "$VMDISK_MOUNT_OPTIONS" && echo "VMDISK_MOUNT_OPTIONS='${VMDISK_MOUNT_OPTIONS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data -- 2.7.4