From a152e676f94fd1ff47bb19a9e37f823b7ad4621f Mon Sep 17 00:00:00 2001 From: Samuel Albershtein Date: Tue, 5 May 2026 20:14:49 +0200 Subject: [PATCH] Use PowerShell ProcessorCount for Windows CPU hotplug verification %NUMBER_OF_PROCESSORS% is an inherited environment variable from the parent process (sshd). After CPU hotplug, sshd retains the stale boot-time value, causing SSH commands to report fewer CPUs than actually available. Replace with [Environment]::ProcessorCount which queries the kernel directly via GetSystemInfo, reliably reflecting hotplugged CPUs. This aligns with how kubevirt's own tests use nproc (kernel query) on Linux rather than environment variables. Signed-off-by: Samuel Albershtein --- tests/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index 2dbc309aee..25f66f8442 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -209,7 +209,7 @@ def clean_up_migration_jobs(client, vm): def get_os_cpu_count(vm): if "windows" in vm.name: - cmd = shlex.split("echo %NUMBER_OF_PROCESSORS%") + cmd = shlex.split('powershell.exe -command "[Environment]::ProcessorCount"') else: cmd = shlex.split("nproc") return int(run_ssh_commands(host=vm.ssh_exec, commands=cmd)[0].strip())