From ccdc124eee173a3d15dbbbec4478a517ebb53d0f Mon Sep 17 00:00:00 2001 From: liang-cong-red-hat Date: Sun, 26 Jan 2025 21:21:25 -0500 Subject: [PATCH] Fix two issues 1. Fix undefine error of variable arch 2. Make sure enough huge page memory is allocated for specific host numa node Signed-off-by: liang-cong-red-hat --- libvirt/tests/src/numa/guest_numa.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libvirt/tests/src/numa/guest_numa.py b/libvirt/tests/src/numa/guest_numa.py index c9a94eabf3..27c880b856 100644 --- a/libvirt/tests/src/numa/guest_numa.py +++ b/libvirt/tests/src/numa/guest_numa.py @@ -62,6 +62,7 @@ def dynamic_node_replacement(params, numa_info, test_obj): key_names = ['memnode_nodeset_', 'page_nodenum_'] for param in params: if 'numa_cells_with_memory_required' in param: + arch = platform.machine() if 'ppc64' in arch: if not node_list: test_obj.cancel("No NUMA nodes available on this system to perform the test.") @@ -291,6 +292,20 @@ def _update_qemu_conf(): deallocate = True hp_cl.target_hugepages = hugepage_num hp_cl.set_hugepages() + # for strict mode, allocate the guest numa cell again to + # make sure it has enough huge page + numa_hugepage_dict = {} + if numa_memnode and numa_memnode[0]['mode'] == 'strict': + if numa_cell: + for cell in numa_cell: + if cell['id'] == numa_memnode[0]['cellid']: + numa_hugepage_dict['node'] = numa_memnode[0]['nodeset'] + numa_hugepage_dict['hp_num'] = int( + cell['memory']) // default_mem_huge_page_size + numa_hugepage_dict['hp_size'] = default_mem_huge_page_size + if numa_hugepage_dict: + hp_cl.set_node_num_huge_pages( + numa_hugepage_dict['hp_num'], numa_hugepage_dict['node'], numa_hugepage_dict['hp_size']) if page_list: hp_size = [h_list[p_size]['size'] for p_size in range(len(h_list))] multi_hp_size = hp_cl.get_multi_supported_hugepage_size()