diff options
author | Nik Lutz <nik@netstyle.ch> | 2016-05-18 08:53:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-05-18 18:26:07 +0000 |
commit | 596a6e51710b71ec8f48322b5e8fb459eec5f66e (patch) | |
tree | a242983e33f6a95f217baf5ebe49eb302004eda6 /lib/container/start | |
parent | Replacing systemd-nspawn '--network-bridge=' with one config file per interfa... (diff) | |
download | compute-tools-596a6e51710b71ec8f48322b5e8fb459eec5f66e.tar.xz compute-tools-596a6e51710b71ec8f48322b5e8fb459eec5f66e.zip |
Swaping parsing order of NETWORK_VETH_EXTRA and NETWORK_BRIDGES.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'lib/container/start')
-rwxr-xr-x | lib/container/start | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/container/start b/lib/container/start index 112ee9b..d0e7e6e 100755 --- a/lib/container/start +++ b/lib/container/start @@ -185,57 +185,57 @@ then MACHINE="--machine=${NAME}" - NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + NETWORK_VETH_EXTRA="" - case "${NETWORK_BRIDGES}" in + case "${NETWORK_VETH_EXTRA_CONF}" in "") ;; *) - for BRIDGE_DEFINITION in ${NETWORK_BRIDGES} + for VETH in ${NETWORK_VETH_EXTRA_CONF} do - INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')" - BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')" - - if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ] - then + NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}" + INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF allow-hotplug ${INTERFACE} iface ${INTERFACE} inet manual pre-up ifconfig ${INTERFACE} up - post-up brctl addif ${BRIDGE} ${INTERFACE} - pre-down brctl delif ${BRIDGE} ${INTERFACE} post-down ifconfig ${INTERFACE} down EOF - else - echo "'${BRIDGE_DEFINITION}': no such devices, ignoring" >&2 - fi done ;; esac - NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" - NETWORK_VETH_EXTRA="" + NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)" - case "${NETWORK_VETH_EXTRA_CONF}" in + case "${NETWORK_BRIDGES}" in "") ;; *) - for VETH in ${NETWORK_VETH_EXTRA_CONF} + for BRIDGE_DEFINITION in ${NETWORK_BRIDGES} do - NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}" - INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" + INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')" + BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')" + + if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ] + then cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF allow-hotplug ${INTERFACE} iface ${INTERFACE} inet manual pre-up ifconfig ${INTERFACE} up + post-up brctl addif ${BRIDGE} ${INTERFACE} + pre-down brctl delif ${BRIDGE} ${INTERFACE} post-down ifconfig ${INTERFACE} down EOF + else + echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected <bridge>:<interface>): Ignoring" + fi done ;; esac |