summaryrefslogtreecommitdiffstats
path: root/libexec/container/start
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-06-30 07:01:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-06-30 07:01:14 +0000
commit5bba39923f92b9b207728da526b7aade5ab732d4 (patch)
treebcfae48108526004367645d915fecaebbdce526a /libexec/container/start
parentAdding upstream version 20210629. (diff)
downloadopen-infrastructure-compute-tools-5bba39923f92b9b207728da526b7aade5ab732d4.tar.xz
open-infrastructure-compute-tools-5bba39923f92b9b207728da526b7aade5ab732d4.zip
Adding upstream version 20210630.upstream/20210630
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/start')
-rwxr-xr-xlibexec/container/start68
1 files changed, 36 insertions, 32 deletions
diff --git a/libexec/container/start b/libexec/container/start
index 6b35ea8..08c3611 100755
--- a/libexec/container/start
+++ b/libexec/container/start
@@ -367,6 +367,42 @@ then
;;
esac
+ NETWORK_BRIDGES="$(awk -Fcnt.network-bridge= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
+
+ case "${NETWORK_BRIDGES}" in
+ "")
+ ;;
+
+ *)
+ for BRIDGE_DEFINITION in ${NETWORK_BRIDGES}
+ do
+ INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')"
+ BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')"
+
+ if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ]
+ then
+ echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working."
+ fi
+
+ if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ]
+ then
+
+cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF
+allow-hotplug ${INTERFACE}
+iface ${INTERFACE} inet manual
+ pre-up ip link set ${INTERFACE} up
+ post-up ip link set ${INTERFACE} master ${BRIDGE}
+ pre-down ip link set ${INTERFACE} nomaster
+ post-down ip link set ${INTERFACE} down
+EOF
+
+ else
+ echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected <bridge>:<interface>): Ignoring"
+ fi
+ done
+ ;;
+ esac
+
PRIVATE_USERS="$(awk -Fprivate-users= '/^private-users=/ { print $2 }' ${CONFIG}/${NAME}.conf || echo no)"
case "${PRIVATE_USERS}" in
@@ -500,35 +536,3 @@ case "${START}" in
esac
;;
esac
-
-# waiting for systemd-nspawn to create the veth interfaces
-sleep 1
-NETWORK_BRIDGES="$(awk -Fcnt.network-bridge= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)"
-
-case "${NETWORK_BRIDGES}" in
- "")
- ;;
-
- *)
- for BRIDGE_DEFINITION in ${NETWORK_BRIDGES}
- do
- INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')"
- BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')"
-
- if [ "$(echo ${INTERFACE} | wc -c)" -gt 15 ]
- then
- echo "'${INTERFACE}': name exceeds maximum of 15 characters, network might be not working."
- fi
-
- if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ]
- then
-
- ip link set "${INTERFACE}" up
- ovs-vsctl --may-exist add-port "${BRIDGE}" "${INTERFACE}"
-
- else
- echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected <bridge>:<interface>): Ignoring"
- fi
- done
- ;;
-esac