From 8a0fa12483ace97d13ed5ed3c7adc6ae7ba64a75 Mon Sep 17 00:00:00 2001 From: jamepark4 Date: Mon, 16 Feb 2026 16:45:51 -0500 Subject: [PATCH] [libvirt_manager] Allow for multi-numa guest deployment Allow for guests to deploy with multiple numa nodes if a numa key is supplied to the cifmw_libvirt_manager_configuration when defining a guest. This is useful when testing multi-numa environments that take advantage of NUMA affinity and managing cpu policy across a slightly more complex architecture. Logic assumes operator will define an evenly distributed system and will not take into account remainders. Signed-off-by: James Parker jparker@redhat.com --- roles/libvirt_manager/templates/domain.xml.j2 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/roles/libvirt_manager/templates/domain.xml.j2 b/roles/libvirt_manager/templates/domain.xml.j2 index d52bfb4f9e..de2c215778 100644 --- a/roles/libvirt_manager/templates/domain.xml.j2 +++ b/roles/libvirt_manager/templates/domain.xml.j2 @@ -16,7 +16,20 @@ - + +{% if vm_data.numa is defined and vm_data.numa|int > 1 %} + + {% set cores_per_node = (vm_data.cpus|int // vm_data.numa|int) %} + {% set mem_per_node = (vm_data.memory|int // vm_data.numa|int) %} + {% set cpu_ns = namespace(cpu_start=0) %} + {% for i in range(vm_data.numa|int) %} + {% set cpu_end = cpu_ns.cpu_start + cores_per_node - 1 %} + + {% set cpu_ns.cpu_start = cpu_end + 1 %} + {% endfor %} + +{% endif %} +