diff options
| author | Zuul <zuul@review.opendev.org> | 2026-11-22 11:15:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2026-11-22 11:15:28 +0000 |
| commit | 08cbeea75e71b3b69d4d12cb03cbf2bafb7b06b4 (patch) | |
| tree | bcf0f2feac1ed73f91a3e996721e1e8bba2f081e | |
| parent | 76a35ea47ba1e07aaa0ccf3a448996197c4166e4 (diff) | |
| parent | 89867681515211cf36fb035291db4bfb20c220ab (diff) | |
| download | kolla-08cbeea75e71b3b69d4d12cb03cbf2bafb7b06b4.tar.gz kolla-08cbeea75e71b3b69d4d12cb03cbf2bafb7b06b4.zip | |
| -rw-r--r-- | kolla/docker/neutron/neutron-base/dnsmasq | 16 | ||||
| -rw-r--r-- | kolla/docker/neutron/neutron-base/haproxy | 16 | ||||
| -rw-r--r-- | kolla/docker/neutron/neutron-base/keepalived | 16 | ||||
| -rw-r--r-- | kolla/docker/neutron/neutron-base/radvd | 15 |
4 files changed, 48 insertions, 15 deletions
diff --git a/kolla/docker/neutron/neutron-base/dnsmasq b/kolla/docker/neutron/neutron-base/dnsmasq index 44b73f0b2..9138e7f66 100644 --- a/kolla/docker/neutron/neutron-base/dnsmasq +++ b/kolla/docker/neutron/neutron-base/dnsmasq @@ -24,10 +24,18 @@ else exit 1 fi -LIST=$($CLI ps -a --filter name=${SERVICE}_dnsmasq_ --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}') - -# If the NAME is already taken by a container, give it an unique name -printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}_$(date +%Y-%m-%d-%H%M%S-%N)" +# NOTE: Neutron may respawn dnsmasq right after killing the previous +# instance, before the container runtime has finished tearing down the +# old --rm container, so its name can still be taken. Wait for the name +# to be released and remove the old container if it is still there. +for _ in $(seq 1 10); do + $CLI container inspect "${NAME}" >/dev/null 2>&1 || break + sleep 0.5 +done +if $CLI container inspect "${NAME}" >/dev/null 2>&1; then + echo "Removing leftover child container ${NAME}" + $CLI rm -f "${NAME}" >/dev/null +fi echo "Starting a new child container ${NAME} using image ${KOLLA_IMAGE}" $CLI run --rm --detach \ diff --git a/kolla/docker/neutron/neutron-base/haproxy b/kolla/docker/neutron/neutron-base/haproxy index 43b9ef9d2..524b7b7dd 100644 --- a/kolla/docker/neutron/neutron-base/haproxy +++ b/kolla/docker/neutron/neutron-base/haproxy @@ -24,10 +24,18 @@ else exit 1 fi -LIST=$($CLI ps -a --filter name=${KOLLA_NAME}_haproxy_ --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}') - -# If the NAME is already taken by a container, give it an unique name -printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}_$(date +%Y-%m-%d-%H%M%S-%N)" +# NOTE: Neutron may respawn haproxy right after killing the previous +# instance, before the container runtime has finished tearing down the +# old --rm container, so its name can still be taken. Wait for the name +# to be released and remove the old container if it is still there. +for _ in $(seq 1 10); do + $CLI container inspect "${NAME}" >/dev/null 2>&1 || break + sleep 0.5 +done +if $CLI container inspect "${NAME}" >/dev/null 2>&1; then + echo "Removing leftover child container ${NAME}" + $CLI rm -f "${NAME}" >/dev/null +fi echo "Starting a new child container ${NAME} using image ${KOLLA_IMAGE}" $CLI run --rm --detach \ diff --git a/kolla/docker/neutron/neutron-base/keepalived b/kolla/docker/neutron/neutron-base/keepalived index 6bb2b4d3d..1ad95d32e 100644 --- a/kolla/docker/neutron/neutron-base/keepalived +++ b/kolla/docker/neutron/neutron-base/keepalived @@ -24,10 +24,18 @@ else exit 1 fi -LIST=$($CLI ps -a --filter name=${KOLLA_SERVICE}_keepalived_ --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}') - -# If the NAME is already taken by a container, give it an unique name -printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}_$(date +%Y-%m-%d-%H%M%S-%N)" +# NOTE: Neutron may respawn keepalived right after killing the previous +# instance, before the container runtime has finished tearing down the +# old --rm container, so its name can still be taken. Wait for the name +# to be released and remove the old container if it is still there. +for _ in $(seq 1 10); do + $CLI container inspect "${NAME}" >/dev/null 2>&1 || break + sleep 0.5 +done +if $CLI container inspect "${NAME}" >/dev/null 2>&1; then + echo "Removing leftover child container ${NAME}" + $CLI rm -f "${NAME}" >/dev/null +fi echo "Starting a new child container ${NAME} using image ${KOLLA_IMAGE}" $CLI run --rm --detach \ diff --git a/kolla/docker/neutron/neutron-base/radvd b/kolla/docker/neutron/neutron-base/radvd index 3f5dd1cfa..dac159130 100644 --- a/kolla/docker/neutron/neutron-base/radvd +++ b/kolla/docker/neutron/neutron-base/radvd @@ -22,9 +22,18 @@ else exit 1 fi -LIST=$($CLI ps -a --filter name=${KOLLA_NAME}_radvd_ --format '{{.ID}}:{{.Names}}:{{.Status}}' | awk '{print $1}') -# If the NAME is already taken by a container, give it an unique name -printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}_$(date +%Y-%m-%d-%H%M%S-%N)" +# NOTE: Neutron may respawn radvd right after killing the previous +# instance, before the container runtime has finished tearing down the +# old --rm container, so its name can still be taken. Wait for the name +# to be released and remove the old container if it is still there. +for _ in $(seq 1 10); do + $CLI container inspect "${NAME}" >/dev/null 2>&1 || break + sleep 0.5 +done +if $CLI container inspect "${NAME}" >/dev/null 2>&1; then + echo "Removing leftover child container ${NAME}" + $CLI rm -f "${NAME}" >/dev/null +fi echo "Starting a new child container ${NAME} using image ${KOLLA_IMAGE}" $CLI run --rm --detach \ |
