Remove side-car containers in Create status

The change Ib3c41a8bee349856d21f360595e41a9eafd79323 added a mechanism
to remove side-car containers before spawning a new one for the same
network.

For dnsmasq side-car, it matches on container statuses Exited
and Created, while all remaining containers match on Exited only.
However if a node running side-car is shut down ungracefully, containers
end in Created status and wrapper script won't be able to start the
containers because they already exist.

This change goes only to Train because in current master (Ussuri) these
wrappers were replaced by ansible.

Change-Id: I7909cd18c7a123d64d24ebc33167d415a8cfb228
This commit is contained in:
Jakub Libosvar 2020-02-04 18:18:58 +01:00
parent 09fa984a6e
commit 378580d3d8
4 changed files with 8 additions and 4 deletions

View File

@ -37,7 +37,8 @@ CMD='echo noop'
LIST=$($CLI ps -a --filter name=neutron-dibbler- --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}')
# Find orphaned containers left for dead after its main process terminated by neutron parent process
ORPHANTS=$(printf "%s\n" "${LIST}" | grep ":Exited")
# FIXME(cjeanner): https://github.com/containers/libpod/issues/1703
ORPHANTS=$(printf "%s\n" "${LIST}" | grep -E ":(Exited|Created)")
if [ -n "${ORPHANTS}" ]; then
for orphant in $(printf "%s\n" "${ORPHANTS}" | awk -F':' '{print $1}'); do
echo "Removing orphaned container ${orphant}"

View File

@ -35,7 +35,8 @@ CMD='echo noop'
LIST=$($CLI ps -a --filter name=neutron-haproxy- --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}')
# Find orphaned containers left for dead after its main process terminated by neutron parent process
ORPHANTS=$(printf "%s\n" "${LIST}" | grep ":Exited")
# FIXME(cjeanner): https://github.com/containers/libpod/issues/1703
ORPHANTS=$(printf "%s\n" "${LIST}" | grep -E ":(Exited|Created)")
if [ -n "${ORPHANTS}" ]; then
for orphant in $(printf "%s\n" "${ORPHANTS}" | awk -F':' '{print $1}'); do
echo "Removing orphaned container ${orphant}"

View File

@ -34,7 +34,8 @@ CMD='echo noop'
LIST=$($CLI ps -a --filter name=neutron-keepalived- --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}')
# Find orphaned containers left for dead after its main process terminated by neutron parent process
ORPHANTS=$(printf "%s\n" "${LIST}" | grep ":Exited")
# FIXME(cjeanner): https://github.com/containers/libpod/issues/1703
ORPHANTS=$(printf "%s\n" "${LIST}" | grep -E ":(Exited|Created)")
if [ -n "${ORPHANTS}" ]; then
for orphant in $(printf "%s\n" "${ORPHANTS}" | awk -F':' '{print $1}'); do
echo "Removing orphaned container ${orphant}"

View File

@ -34,7 +34,8 @@ CMD='echo noop'
LIST=$($CLI ps -a --filter name=neutron-radvd- --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}')
# Find orphaned containers left for dead after its main process terminated by neutron parent process
ORPHANTS=$(printf "%s\n" "${LIST}" | grep ":Exited")
# FIXME(cjeanner): https://github.com/containers/libpod/issues/1703
ORPHANTS=$(printf "%s\n" "${LIST}" | grep -E ":(Exited|Created)")
if [ -n "${ORPHANTS}" ]; then
for orphant in $(printf "%s\n" "${ORPHANTS}" | awk -F':' '{print $1}'); do
echo "Removing orphaned container ${orphant}"