From a697845e4b0b76e445c5bc67fce1e3934728c16c Mon Sep 17 00:00:00 2001 From: Anushree-Mathur Date: Mon, 24 Nov 2025 00:29:04 +0530 Subject: [PATCH] Fixing maxvcpu mismatch with topology issue, making it dynamic! Maxvcpu is hardcoded for the specific testcase in virsh_emulatorpin.py. When smp value, vcpu_cores, vcpu_threads, vcpu_sockets is specified at the time of running the testcase then the hardcoded value will fail. Adding the code to get this value dynamically based on the smp value provided in the test suite config file. 1 example is that hardcoded value is 7 in virsh_emulatorpin.cfg but in the testsuite config smp value given is 32 not topology will be affected in this case my check will help. Signed-off-by: Anushree-Mathur --- libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py b/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py index 47cdfa3beae..74f19fd2f36 100644 --- a/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py +++ b/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py @@ -273,6 +273,11 @@ def run(test, params, env): if 'cpuset' in vcpu_attrs: if vcpu_attrs['cpuset'] == "x,y": vcpu_attrs['cpuset'] = "0,%s" % (cpu_max - 1) + # Updating max cpus according to smp value if topology is present + if vmxml.get_cpu_topology(): + topology = vmxml.get_cpu_topology() + max_vcpu = (int(topology['sockets']) * int(topology['cores']) * int(topology['threads'])) + vcpu_attrs['vcpu'] = max_vcpu vmxml.setup_attrs(**vcpu_attrs) vmxml.sync() try: