aboutsummaryrefslogtreecommitdiff
path: root/docker/openvswitch
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2024-01-10 07:59:11 +0100
committerMichal Nasiadka <mnasiadka@gmail.com>2024-03-23 15:10:16 +0000
commit426744a271b1a081b6967c071815b1ed9c49108c (patch)
treef891ebd25b75b7e9329dc918fcbaf56913264700 /docker/openvswitch
parente8a6a457211b58ed966ed2faab0266bb8e3a7595 (diff)
downloadkolla-426744a271b1a081b6967c071815b1ed9c49108c.tar.gz
kolla-426744a271b1a081b6967c071815b1ed9c49108c.zip
openvswitch: Add ovs_wrapper for handling TERM
Partial-Bug: #2048130 Change-Id: I81eba2644eda6edd38c541f798bead04c2fa6578
Diffstat (limited to 'docker/openvswitch')
-rw-r--r--docker/openvswitch/openvswitch-base/Dockerfile.j24
-rw-r--r--docker/openvswitch/openvswitch-base/ovs_wrapper.sh19
2 files changed, 22 insertions, 1 deletions
diff --git a/docker/openvswitch/openvswitch-base/Dockerfile.j2 b/docker/openvswitch/openvswitch-base/Dockerfile.j2
index 5ae3dc15b..52ee47a44 100644
--- a/docker/openvswitch/openvswitch-base/Dockerfile.j2
+++ b/docker/openvswitch/openvswitch-base/Dockerfile.j2
@@ -33,10 +33,12 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% endblock %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
+COPY ovs_wrapper.sh /usr/local/bin/ovs_wrapper
# NOTE(hrw): Upstream moved tcpdump to /usr/bin/ in 4.99 version (used in Debian)
RUN if [ -e /usr/sbin/tcpdump ]; then mv /usr/sbin/tcpdump /usr/bin/tcpdump; fi \
&& touch /usr/local/bin/kolla_openvswitch_extend_start \
- && chmod 644 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_openvswitch_extend_start
+ && chmod 644 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_openvswitch_extend_start \
+ && chmod 755 /usr/local/bin/ovs_wrapper
{% block openvswitch_base_footer %}{% endblock %}
diff --git a/docker/openvswitch/openvswitch-base/ovs_wrapper.sh b/docker/openvswitch/openvswitch-base/ovs_wrapper.sh
new file mode 100644
index 000000000..552c496ac
--- /dev/null
+++ b/docker/openvswitch/openvswitch-base/ovs_wrapper.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+catch_term() {
+ ovs-appctl -T1 -t /run/openvswitch/$1.$child.ctl exit
+ exit 0
+}
+
+catch_quit() {
+ ovs-appctl -T1 -t /run/openvswitch/$1.$child.ctl exit
+ exit 0
+}
+
+trap catch_term SIGTERM
+trap catch_quit SIGQUIT
+
+"$@" &
+
+child=$!
+wait "$child"