Use cgroupsv2 for L3 cleanup

During OpenStack upgrades we need to ensure that no process is running
with the old code base. For that we used to kill L3 agent processes
except ones running haporoxy/keepalived.

However that handler was broken with migration of systems to cgroupsv2
as it was relying on a filepath for cgroups.
As all modern operating systems already migrated to cgroupsv2 or use
them in compatability mode, let's detect the actual path and use it
instead of the hardcoded one.

Change-Id: I717f3cf13a8001a1f2077a325c4ec451f45f9f74
This commit is contained in:
Dmitriy Rabotyagov 2024-09-04 16:18:51 +02:00
parent d81a2fb7aa
commit 6e23144f48

View File

@ -60,7 +60,8 @@
# orphaned processes are cleaned up correctly.
- name: Run neutron-l3-agent process cleanup
shell: |
for ns_pid in $(cat /sys/fs/cgroup/pids/neutron.slice/neutron-l3-agent.service/cgroup.procs); do
cgroup_path=$(findmnt -t cgroup2 -r -n -f -o target)
for ns_pid in $(cat ${cgroup_path}/neutron.slice/neutron-l3-agent.service/cgroup.procs); do
echo $(readlink -f "/proc/$ns_pid/exe") | egrep -qv "keepalived|haproxy"
if [ $? -eq 0 ] || [ "{{ neutron_l3_cleanup_on_shutdown | bool }}" = "True" ]; then
if kill -9 "$ns_pid"; then