summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon Spöhel <simon@spoehel.ch>2021-04-14 07:37:44 +0000
committerSakirnth Nagarasa <sakirnth@gmail.com>2021-09-01 08:24:51 +0000
commit6bd4ac624ef89746c492c29b4eebcfef992ebdc9 (patch)
treeefaa1a1d76944e4999a832638eb43bf97b96f201 /lib
parentstop openvswitch version. (diff)
downloadcompute-tools-6bd4ac624ef89746c492c29b4eebcfef992ebdc9.tar.xz
compute-tools-6bd4ac624ef89746c492c29b4eebcfef992ebdc9.zip
start openvswitch version.
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/start70
1 files changed, 34 insertions, 36 deletions
diff --git a/libexec/container/start b/libexec/container/start
index 6ec44f4..58023aa 100755
--- a/libexec/container/start
+++ b/libexec/container/start
@@ -370,42 +370,6 @@ 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 ovs-vsctl add-port "${BRIDGE}" "${INTERFACE}"
- pre-down ovs-vsctl --with-iface del-port "${BRIDGE}" "${INTERFACE}"
- 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
@@ -514,6 +478,7 @@ esac
case "${START}" in
true)
+
case "${SET_PROPERTY}" in
true)
systemctl --runtime set-property ${NAME} ${BLOCK_IO_DEVICE_WEIGHT} ${BLOCK_IO_READ_BANDWIDTH} ${BLOCK_IO_WEIGHT} ${BLOCK_IO_WRITE_BANDWIDTH} ${CPU_QUOTA} ${CPU_SHARES} ${MEMORY_LIMIT} ${TASKS_MAX}
@@ -532,6 +497,7 @@ case "${START}" in
${SETARCH} systemd-nspawn --keep-unit ${BIND} ${BIND_RO} ${BOOT} ${CAPABILITY} ${DIRECTORY} ${DROP_CAPABILITY} ${MACHINE} ${NETWORK_VETH_EXTRA} ${LINK_JOURNAL} ${REGISTER}
+
case "${VERBOSE}" in
true)
echo " done."
@@ -539,3 +505,35 @@ case "${START}" in
esac
;;
esac
+
+# we have to wait 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