From 6d431dfebc00dc82b4f8b2622796b4e6040dc9b9 Mon Sep 17 00:00:00 2001 From: liang-cong-red-hat Date: Thu, 2 Jan 2025 02:44:25 -0500 Subject: [PATCH] Add default value 0 when specific cpu topology file is missing Signed-off-by: liang-cong-red-hat --- libvirt/tests/cfg/numa/numa_capabilities.cfg | 3 +++ libvirt/tests/src/numa/numa_capabilities.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/libvirt/tests/cfg/numa/numa_capabilities.cfg b/libvirt/tests/cfg/numa/numa_capabilities.cfg index c551749681..34254c60fd 100644 --- a/libvirt/tests/cfg/numa/numa_capabilities.cfg +++ b/libvirt/tests/cfg/numa/numa_capabilities.cfg @@ -5,3 +5,6 @@ status_error = "no" variants: - default: + aarch64: + missing_cpu_topology_key = 'die_id' + diff --git a/libvirt/tests/src/numa/numa_capabilities.py b/libvirt/tests/src/numa/numa_capabilities.py index fe39e92388..942e3d2e0d 100644 --- a/libvirt/tests/src/numa/numa_capabilities.py +++ b/libvirt/tests/src/numa/numa_capabilities.py @@ -14,6 +14,7 @@ def run(test, params, env): """ Test capabilities with host numa node topology """ + missing_cpu_topology_key = params.get("missing_cpu_topology_key") libvirtd = utils_libvirtd.Libvirtd() libvirtd.start() try: @@ -49,6 +50,10 @@ def run(test, params, env): cpu_topo_list = [] for cpu_id in cpu_list: cpu_dict = node_.get_cpu_topology(cpu_id) + # if specific cpu topology file from sysfs doesn't exist, default 0 + # would be used in virsh capabilities + if missing_cpu_topology_key and cpu_dict[missing_cpu_topology_key] is None: + cpu_dict[missing_cpu_topology_key] = '0' cpu_topo_list.append(cpu_dict) logging.debug("cpu topology list from capabilities xml is %s", cpu_list_from_xml)