From 5c5677e254f9efdbaf653d5f7d9ca18dc89d56e2 Mon Sep 17 00:00:00 2001 From: Anushree-Mathur Date: Thu, 4 Dec 2025 11:09:04 +0530 Subject: [PATCH] Replacing pidof with pgrep to make it more generic! In the latest versions of QEMU, the QEMU process may run as qemu-system-, where represents any supported architecture. However, in some cases, it may still run as qemu-kvm. To ensure a more generic and reliable approach for identifying the QEMU process ID, it is recommended to replace the pidof command with pgrep, as pgrep provides broader compatibility and flexibility. Signed-off-by: Anushree-Mathur --- libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py b/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py index 47cdfa3beae..657ab3ba97c 100644 --- a/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py +++ b/libvirt/tests/src/virsh_cmd/domain/virsh_emulatorpin.py @@ -220,7 +220,9 @@ def check_allowed_list(test, check_list): :raises: test.fail if get unexpected emulatorpin value :return: None """ - pid = process.run('pidof qemu-kvm', shell=True).stdout_text.strip() + # Generic command to get top process id for qemu-kvm or qemu-system-* + pid_cmd = "pgrep -x \"$(ps -eo comm | grep -E \'^(qemu-system-|qemu-kvm)\' | head -n1)\"" + pid = process.run(pid_cmd, shell=True).stdout_text.strip() res = cpuutils.cpu_allowed_list_by_task(pid, pid) if res == check_list: logging.info("Get expected emulatorpin value.")