From 2921c8401144fd64848c2dc8bfadaba04e9d9422 Mon Sep 17 00:00:00 2001 From: panhengchang Date: Tue, 22 Apr 2025 20:51:09 +0800 Subject: [PATCH] modify the virtcca numa check --- nova/virt/hardware.py | 52 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index f004aa4..d372d76 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -2674,33 +2674,31 @@ def virtcca_numa_fit_instance_to_host( host_cells, len(instance_topology)): chosen_instance_cells: ty.List['objects.InstanceNUMACell'] = [] chosen_host_cells: ty.List['objects.NUMACell'] = [] - # for host_cell, instance_cell in zip( - # host_cell_perm, instance_topology.cells): - for host_cell in host_cell_perm: - cell_index = 0 - for instance_cell in instance_topology.cells: - try: - cpuset_reserved = 0 - if (instance_topology.emulator_threads_isolated and - len(chosen_instance_cells) == 0): - # For the case of isolate emulator threads, to - # make predictable where that CPU overhead is - # located we always configure it to be on host - # NUMA node associated to the guest NUMA node - # 0. - cpuset_reserved = 1 - got_cell = _virtcca_numa_fit_instance_cell( - host_cell, instance_cell, limits, cpuset_reserved, imageMeta, cell_index) - except exception.MemoryPageSizeNotSupported: - # This exception will been raised if instance cell's - # custom pagesize is not supported with host cell in - # _numa_cell_supports_pagesize_request function. - break - if got_cell is None: - break - cell_index = cell_index + 1 - chosen_host_cells.append(host_cell) - chosen_instance_cells.append(got_cell) + cell_index = 0 + for host_cell, instance_cell in zip( + host_cell_perm, instance_topology.cells): + try: + cpuset_reserved = 0 + if (instance_topology.emulator_threads_isolated and + len(chosen_instance_cells) == 0): + # For the case of isolate emulator threads, to + # make predictable where that CPU overhead is + # located we always configure it to be on host + # NUMA node associated to the guest NUMA node + # 0. + cpuset_reserved = 1 + got_cell = _virtcca_numa_fit_instance_cell( + host_cell, instance_cell, limits, cpuset_reserved, imageMeta, cell_index) + except exception.MemoryPageSizeNotSupported: + # This exception will been raised if instance cell's + # custom pagesize is not supported with host cell in + # _numa_cell_supports_pagesize_request function. + break + if got_cell is None: + break + cell_index = cell_index + 1 + chosen_host_cells.append(host_cell) + chosen_instance_cells.append(got_cell) if len(chosen_instance_cells) != len(host_cell_perm): continue -- Gitee