summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2019-04-27 13:55:23 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2019-08-11 08:48:22 +0000
commita477d8cdc72ead822f36d31c6a4aca6ec2269ac4 (patch)
treedc6549345c5587419139c49b21731c8dc0bd496f
parentRemoving stray veth links when starting containers with force. (diff)
downloadcompute-tools-a477d8cdc72ead822f36d31c6a4aca6ec2269ac4.tar.xz
compute-tools-a477d8cdc72ead822f36d31c6a4aca6ec2269ac4.zip
Removing stray veth links when stopping containers with force.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xlib/container/stop11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/container/stop b/lib/container/stop
index 3a0de2a..350d9e6 100755
--- a/lib/container/stop
+++ b/lib/container/stop
@@ -255,6 +255,17 @@ esac
# Run
machinectl ${MODE} ${NAME}
+case "${FORCE}" in
+ true)
+ VETHS="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf | awk -F: '{ print $1 }')"
+
+ for VETH in ${VETHS}
+ do
+ ip link delete ${VETH} > /dev/null 2>&1 || true
+ done
+ ;;
+esac
+
# Post hooks
for FILE in "${HOOKS}/post-${COMMAND}".* "${HOOKS}/${NAME}.post-${COMMAND}"
do