summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf
diff options
context:
space:
mode:
authorNik Lutz <nik@netstyle.ch>2016-05-12 15:40:10 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-05-18 18:26:06 +0000
commitbc53e5a0e1a692200313d64ff0a1fd8d8b34ab4f (patch)
tree182218c80b551f28ec8109c8de324acef1dd026d /share/scripts/debconf
parentAdding veth name (cnt-debconf/network[0-9]/veth) configuration option to debc... (diff)
downloadcompute-tools-bc53e5a0e1a692200313d64ff0a1fd8d8b34ab4f.tar.xz
compute-tools-bc53e5a0e1a692200313d64ff0a1fd8d8b34ab4f.zip
Using systemd-nspawn '--network-veth-extra=' instead of '--network-veth' (prerequisite for multiple network interface support per container).
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-xshare/scripts/debconf25
1 files changed, 25 insertions, 0 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf
index 28e95fd..24202b0 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -904,6 +904,29 @@ Commands ()
# config (FIXME)
sed -i -e "s|^network-bridge=.*|network-bridge=${NETWORK0_BRIDGE}|" "${CONFIG}/${NAME}.conf"
+ # maximum of 15 characters, prefix is 'veth-'
+ HOSTNAME_SHORT="$(echo ${NAME} | cut -c-8)"
+ HOST_INTERFACE_NAME="$(echo ${NETWORK0_VETH:-veth-${HOSTNAME_SHORT}-0})"
+
+ sed -i -e "s|^network-veth-extra=.*|network-veth-extra=${HOST_INTERFACE_NAME}:eth0|g" "${CONFIG}/${NAME}.conf"
+
+ for NUMBER in $(seq 1 ${NETWORK_NUMBER})
+ do
+ eval IPV4_METHOD="$`echo NETWORK${NUMBER}_IPV4_METHOD`"
+
+ if [ -z "${IPV4_METHOD}" ]
+ then
+ continue
+ fi
+
+ eval HOST_INTERFACE_NAME="$`echo NETWORK${NUMBER}_VETH`"
+
+ HOST_INTERFACE_NAME="$(echo ${HOST_INTERFACE_NAME:-veth-${HOSTNAME_SHORT}-${NUMBER}})"
+ CONTAINER_INTERFACE_NAME="eth${NUMBER}"
+
+ sed -i -e "/^register=.*/ a network-veth-extra=${HOST_INTERFACE_NAME}:${CONTAINER_INTERFACE_NAME}" "${CONFIG}/${NAME}.conf"
+ done
+
# Setting root password
echo root:${ROOT_PASSWORD} | chroot "${DIRECTORY}" chpasswd
@@ -932,6 +955,8 @@ SYSTEM="${MACHINES}/${NAME}"
Debconf
+export NAME
+
# Run debconf parts
for SCRIPT in /usr/share/container-tools/scripts/debconf.d/*
do