Browse Source

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.

Closes-bug: #1862010

Change-Id: I7909cd18c7a123d64d24ebc33167d415a8cfb228
(cherry picked from commit 378580d3d8)
changes/37/705937/1
Jakub Libosvar 2 weeks ago
parent
commit
5863f5ff63
4 changed files with 8 additions and 4 deletions
  1. +2
    -1
      templates/neutron/dibbler-client.epp
  2. +2
    -1
      templates/neutron/haproxy.epp
  3. +2
    -1
      templates/neutron/keepalived.epp
  4. +2
    -1
      templates/neutron/radvd.epp

+ 2
- 1
templates/neutron/dibbler-client.epp 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}"

+ 2
- 1
templates/neutron/haproxy.epp 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}"

+ 2
- 1
templates/neutron/keepalived.epp 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}"

+ 2
- 1
templates/neutron/radvd.epp 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}"

Loading…
Cancel
Save