diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-08-11 08:55:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-08-11 08:55:37 +0000 |
commit | 5a663817eb466038a3be8f73d0d5cc9e25727966 (patch) | |
tree | 28408e4b99a9f86dd13924232f9a6d55d35e975f /lib/container | |
parent | Adding upstream version 20190413. (diff) | |
download | open-infrastructure-compute-tools-5a663817eb466038a3be8f73d0d5cc9e25727966.tar.xz open-infrastructure-compute-tools-5a663817eb466038a3be8f73d0d5cc9e25727966.zip |
Adding upstream version 20190811.upstream/20190811
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/container')
-rwxr-xr-x | lib/container/create | 20 | ||||
-rwxr-xr-x | lib/container/start | 7 | ||||
-rwxr-xr-x | lib/container/stop | 11 |
3 files changed, 28 insertions, 10 deletions
diff --git a/lib/container/create b/lib/container/create index 8fa6189..1b9defe 100755 --- a/lib/container/create +++ b/lib/container/create @@ -194,9 +194,9 @@ if [ -n "${BIND}" ] then BINDS="$(echo ${BIND} | sed -e 's|;| |g')" - for BIND in ${BINDS} + for ENTRY in ${BINDS} do - DIRECTORY="$(echo ${BIND} | awk -F: '{ print $1 }')" + DIRECTORY="$(echo ${ENTRY} | awk -F: '{ print $1 }')" mkdir -p "${DIRECTORY}" done @@ -205,11 +205,11 @@ fi # Creating ro bind mounts if [ -n "${BIND_RO}" ] then - BINDS="$(echo ${BIND_RO} | sed -e 's|;| |g')" + BINDS_RO="$(echo ${BIND_RO} | sed -e 's|;| |g')" - for BIND_RO in ${BINDS_RO} + for ENTRY in ${BINDS_RO} do - DIRECTORY="$(echo ${BIND_RO} | awk -F: '{ print $1 }')" + DIRECTORY="$(echo ${ENTRY} | awk -F: '{ print $1 }')" mkdir -p "${DIRECTORY}" done @@ -220,12 +220,12 @@ if [ -n "${CNT_OVERLAY}" ] then CNT_OVERLAYS="$(echo ${CNT_OVERLAY} | sed -e 's|;| |g')" - for CNT_OVERLAY in ${CNT_OVERLAYS} + for ENTRY in ${CNT_OVERLAYS} do - DIRECTORY_LOWER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $1 }')" - DIRECTORY_UPPER="$(echo ${CNT_OVERLAY} | awk -F: '{ print $2 }')" - DIRECTORY_WORK="$(echo ${CNT_OVERLAY} | awk -F: '{ print $3 }')" - DIRECTORY_MERGED="$(echo ${CNT_OVERLAY} | awk -F: '{ print $4 }')" + DIRECTORY_LOWER="$(echo ${ENTRY} | awk -F: '{ print $1 }')" + DIRECTORY_UPPER="$(echo ${ENTRY} | awk -F: '{ print $2 }')" + DIRECTORY_WORK="$(echo ${ENTRY} | awk -F: '{ print $3 }')" + DIRECTORY_MERGED="$(echo ${ENTRY} | awk -F: '{ print $4 }')" for DIRECTORY in "${DIRECTORY_LOWER}" "${DIRECTORY_UPPER}" "${DIRECTORY_WORK}" "${DIRECTORY_MERGED}" do diff --git a/lib/container/start b/lib/container/start index d5e9059..47c2907 100755 --- a/lib/container/start +++ b/lib/container/start @@ -144,6 +144,13 @@ then case "${FORCE}" in true) rm -f "${MACHINES}/.#${NAME}.lck" + + 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 ;; *) 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 |