From 789ac7388cbf4f447204b1e4e5fe619222cc4ac2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o=20Gillot-Lamure?=
 <leo.gillot-lamure-ext@socgen.com>
Date: Thu, 18 May 2023 19:23:56 +0200
Subject: [PATCH] loadbalancer: support cpu-map for threads

The directive used has the same semantic as what is done above for nbproc > 1:
it binds each thread to a CPU. It is simpler and does not require a loop because
it uses the auto: syntax available in HAProxy 2.4.

Change-Id: I1ce124b678140f5f4737df557683bb67bc7cfc66
---
 .../roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2   | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ansible/roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2 b/ansible/roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2
index 39a6ceed5..40d571bf9 100644
--- a/ansible/roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2
+++ b/ansible/roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2
@@ -13,6 +13,9 @@ global
     cpu-map {{ cpu_idx + 1 }} {{ cpu_idx }}
         {% endfor %}
     {% endif %}
+    {% if (haproxy_threads | int > 1) and (haproxy_process_cpu_map | bool) %}
+    cpu-map auto:1/all 0-63
+    {% endif %}
     stats socket /var/lib/kolla/haproxy/haproxy.sock group kolla mode 660{% if haproxy_socket_level_admin | bool %} level admin{% endif %}
 
     {% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %}
-- 
GitLab