From b1fd2b40f7cd1c6c457bd42b25ca32dc1e5e0f4f Mon Sep 17 00:00:00 2001
From: Michal Arbet <michal.arbet@ultimum.io>
Date: Thu, 4 Jan 2024 22:26:13 +0100
Subject: [PATCH] Fix long service restarts while using systemd

Some containers exiting with 143 instead of 0, but
this is still OK. This patch just allows
ExitCode 143 (SIGTERM) as fix. Details in
bugreport.

Services which exited with 143 (SIGTERM):

kolla-cron-container.service
kolla-designate_producer-container.service
kolla-keystone_fernet-container.service
kolla-letsencrypt_lego-container.service
kolla-magnum_api-container.service
kolla-mariadb_clustercheck-container.service
kolla-neutron_l3_agent-container.service
kolla-openvswitch_db-container.service
kolla-openvswitch_vswitchd-container.service
kolla-proxysql-container.service

Partial-Bug: #2048130
Change-Id: Ia8c85d03404cfb368e4013066c67acd2a2f68deb
---
 ansible/module_utils/kolla_systemd_worker.py         | 1 +
 releasenotes/notes/bug-2048130-23b8174396bd3c69.yaml | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 releasenotes/notes/bug-2048130-23b8174396bd3c69.yaml

diff --git a/ansible/module_utils/kolla_systemd_worker.py b/ansible/module_utils/kolla_systemd_worker.py
index 396d15c205..442910c07f 100644
--- a/ansible/module_utils/kolla_systemd_worker.py
+++ b/ansible/module_utils/kolla_systemd_worker.py
@@ -32,6 +32,7 @@ ExecStart=/usr/bin/${engine} start -a ${name}
 ExecStop=/usr/bin/${engine} stop ${name} -t ${graceful_timeout}
 Restart=${restart_policy}
 RestartSec=${restart_duration}
+SuccessExitStatus=143
 
 [Install]
 WantedBy=multi-user.target
diff --git a/releasenotes/notes/bug-2048130-23b8174396bd3c69.yaml b/releasenotes/notes/bug-2048130-23b8174396bd3c69.yaml
new file mode 100644
index 0000000000..a1cd5b878a
--- /dev/null
+++ b/releasenotes/notes/bug-2048130-23b8174396bd3c69.yaml
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fixes long service restarts while using systemd
+    `LP#2048130 <https://bugs.launchpad.net/kolla-ansible/+bug/2048130>`__.