* [PATCH 1/5] tests/functional/ppc64: replace deprecated datetime.utcnow()
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
@ 2026-11-20 9:58 ` Aniket Sahu
2026-11-20 9:58 ` [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests Aniket Sahu
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 9:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, peterx, farosas, npiggin, adityag, milesg, harshpb,
rathc, anushree.mathur, misanjum, gautam, thuth, amachhiw,
asahu1x
Replace datetime.utcnow() with datetime.now(timezone.utc) to avoid
deprecation warnings in Python 3.12+.
Also add debug logging when setting the system clock in the L1 guest.
Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
---
tests/functional/ppc64/test_hv.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
index beec1dbbea..8a1fca2cb1 100755
--- a/tests/functional/ppc64/test_hv.py
+++ b/tests/functional/ppc64/test_hv.py
@@ -12,7 +12,7 @@
import os
import subprocess
-from datetime import datetime
+from datetime import datetime, timezone
from qemu_test import QemuSystemTest, Asset
from qemu_test import wait_for_console_pattern, exec_command
from qemu_test import skipIfMissingCommands, skipBigDataTest
@@ -74,8 +74,9 @@ def do_start_alpine(self):
ps1='localhost:~#'
wait_for_console_pattern(self, 'localhost login:')
exec_command_and_wait_for_pattern(self, 'root', ps1)
+ self.log.debug("do_start_alpine: logged in, setting system clock")
# If the time is wrong, SSL certificates can fail.
- cmd='date -s "' + datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S' + '"')
+ cmd='date -s "' + datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S' + '"')
exec_command_and_wait_for_pattern(self, cmd, ps1)
ps1='alpine:~#'
exec_command_and_wait_for_pattern(self, 'setup-alpine -qe', ps1)
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
2026-11-20 9:58 ` [PATCH 1/5] tests/functional/ppc64: replace deprecated datetime.utcnow() Aniket Sahu
@ 2026-11-20 9:58 ` Aniket Sahu
2026-11-20 10:06 ` Daniel P. Berrangé
2026-11-20 9:58 ` [PATCH 3/5] tests/functional/ppc64: add kernel params and early panic detection Aniket Sahu
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 9:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, peterx, farosas, npiggin, adityag, milesg, harshpb,
rathc, anushree.mathur, misanjum, gautam, thuth, amachhiw,
asahu1x
Pin machine types to avoid CPU compatibility issues:
- Use pseries-8.2 (POWER9) for pseries tests instead of generic 'pseries'
alias which resolves to pseries-11.2 (power11_v2.0)
- Use powernv9 for powernv test to ensure consistent PCIe topology
- Fix test_hv_pseries_kvm to use TCG accelerator (L1 runs under TCG,
L2 uses KVM inside L1)
The generic 'pseries' alias now resolves to a machine whose default CPU
(power11) is not known to the qemu-system-ppc64 packaged by Alpine,
causing the L2 guest to fail with "Register sync failed" error.
Signed-off-by: Misbah Anjum N <misanjum@linux.ibm.com>
Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
---
tests/functional/ppc64/test_hv.py | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
index 8a1fca2cb1..d977038271 100755
--- a/tests/functional/ppc64/test_hv.py
+++ b/tests/functional/ppc64/test_hv.py
@@ -125,7 +125,12 @@ def do_test_kvm(self, hpt=False):
def test_hv_pseries(self):
self.require_accelerator("tcg")
self.require_netdev('user')
- self.set_machine('pseries')
+ # Pin to pseries-8.2 (default CPU power9_v2.2) so that kvm-hv.ko inside
+ # the L1 Alpine guest sees a POWER9 register set. The generic 'pseries'
+ # alias resolves to pseries-11.2 (power11_v2.0) which Alpine's packaged
+ # qemu-system-ppc64 does not recognise, causing the L2 "Register sync
+ # failed" error. The L2 script passes '-cpu POWER9' to match.
+ self.set_machine('pseries-8.2')
self.vm.add_args("-accel", "tcg,thread=multi")
self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
@@ -135,10 +140,13 @@ def test_hv_pseries(self):
self.do_stop_alpine()
def test_hv_pseries_kvm(self):
- self.require_accelerator("kvm")
+ # L1 runs under TCG; L2 is launched with accel=kvm inside L1
+ # (see do_test_kvm).
+ self.require_accelerator("tcg")
self.require_netdev('user')
- self.set_machine('pseries')
- self.vm.add_args("-accel", "kvm")
+ # Same CPU pinning rationale as test_hv_pseries above.
+ self.set_machine('pseries-8.2')
+ self.vm.add_args("-accel", "tcg,thread=multi")
self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on,cap-ccf-assist=off")
self.do_start_alpine()
@@ -149,7 +157,9 @@ def test_hv_pseries_kvm(self):
def test_hv_powernv(self):
self.require_accelerator("tcg")
self.require_netdev('user')
- self.set_machine('powernv')
+ # Pin to powernv9 so the PCIe topology matches (pcie.0, pcie.2) and
+ # kvm-hv.ko runs with the POWER9 CPU model.
+ self.set_machine('powernv9')
self.vm.add_args("-accel", "tcg,thread=multi")
self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
'-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests
2026-11-20 9:58 ` [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests Aniket Sahu
@ 2026-11-20 10:06 ` Daniel P. Berrangé
2026-11-20 10:29 ` Aniket Sahu
0 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-11-20 10:06 UTC (permalink / raw)
To: Aniket Sahu
Cc: qemu-devel, qemu-ppc, peterx, farosas, npiggin, adityag, milesg,
harshpb, rathc, anushree.mathur, misanjum, gautam, thuth,
amachhiw
On Fri, Nov 20, 2026 at 03:28:55PM +0530, Aniket Sahu wrote:
> Pin machine types to avoid CPU compatibility issues:
> - Use pseries-8.2 (POWER9) for pseries tests instead of generic 'pseries'
> alias which resolves to pseries-11.2 (power11_v2.0)
> - Use powernv9 for powernv test to ensure consistent PCIe topology
> - Fix test_hv_pseries_kvm to use TCG accelerator (L1 runs under TCG,
> L2 uses KVM inside L1)
>
> The generic 'pseries' alias now resolves to a machine whose default CPU
> (power11) is not known to the qemu-system-ppc64 packaged by Alpine,
> causing the L2 guest to fail with "Register sync failed" error.
>
> Signed-off-by: Misbah Anjum N <misanjum@linux.ibm.com>
> Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
> ---
> tests/functional/ppc64/test_hv.py | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
> index 8a1fca2cb1..d977038271 100755
> --- a/tests/functional/ppc64/test_hv.py
> +++ b/tests/functional/ppc64/test_hv.py
> @@ -125,7 +125,12 @@ def do_test_kvm(self, hpt=False):
> def test_hv_pseries(self):
> self.require_accelerator("tcg")
> self.require_netdev('user')
> - self.set_machine('pseries')
> + # Pin to pseries-8.2 (default CPU power9_v2.2) so that kvm-hv.ko inside
> + # the L1 Alpine guest sees a POWER9 register set. The generic 'pseries'
> + # alias resolves to pseries-11.2 (power11_v2.0) which Alpine's packaged
> + # qemu-system-ppc64 does not recognise, causing the L2 "Register sync
> + # failed" error. The L2 script passes '-cpu POWER9' to match.
> + self.set_machine('pseries-8.2')
If the guest needs POWER9, why not add a "-cpu POWER9" flag to the L1
QEMU here, instead of making assumptions about what the machine type
exposes.
Using old versioned machine types in functional tests is undesirable
as we automatically delete versioned machines after 6 years, at
which point we'll need to address the CPU model choice anyway.
> self.vm.add_args("-accel", "tcg,thread=multi")
> self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
> self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
> @@ -135,10 +140,13 @@ def test_hv_pseries(self):
> self.do_stop_alpine()
>
> def test_hv_pseries_kvm(self):
> - self.require_accelerator("kvm")
> + # L1 runs under TCG; L2 is launched with accel=kvm inside L1
> + # (see do_test_kvm).
> + self.require_accelerator("tcg")
> self.require_netdev('user')
> - self.set_machine('pseries')
> - self.vm.add_args("-accel", "kvm")
> + # Same CPU pinning rationale as test_hv_pseries above.
> + self.set_machine('pseries-8.2')
> + self.vm.add_args("-accel", "tcg,thread=multi")
> self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
> self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on,cap-ccf-assist=off")
> self.do_start_alpine()
> @@ -149,7 +157,9 @@ def test_hv_pseries_kvm(self):
> def test_hv_powernv(self):
> self.require_accelerator("tcg")
> self.require_netdev('user')
> - self.set_machine('powernv')
> + # Pin to powernv9 so the PCIe topology matches (pcie.0, pcie.2) and
> + # kvm-hv.ko runs with the POWER9 CPU model.
> + self.set_machine('powernv9')
> self.vm.add_args("-accel", "tcg,thread=multi")
> self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
> '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
> --
> 2.52.0
>
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests
2026-11-20 10:06 ` Daniel P. Berrangé
@ 2026-11-20 10:29 ` Aniket Sahu
0 siblings, 0 replies; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 10:29 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel, qemu-ppc, peterx, farosas, npiggin, adityag, milesg,
harshpb, rathc, anushree.mathur, misanjum, gautam, thuth,
amachhiw
Hi Daniel,
Thanks for the review!
On 20/11/26 3:36 PM, Daniel P. Berrangé wrote:
> On Fri, Nov 20, 2026 at 03:28:55PM +0530, Aniket Sahu wrote:
>> Pin machine types to avoid CPU compatibility issues:
>> - Use pseries-8.2 (POWER9) for pseries tests instead of generic 'pseries'
>> alias which resolves to pseries-11.2 (power11_v2.0)
>> - Use powernv9 for powernv test to ensure consistent PCIe topology
>> - Fix test_hv_pseries_kvm to use TCG accelerator (L1 runs under TCG,
>> L2 uses KVM inside L1)
>>
>> The generic 'pseries' alias now resolves to a machine whose default CPU
>> (power11) is not known to the qemu-system-ppc64 packaged by Alpine,
>> causing the L2 guest to fail with "Register sync failed" error.
>>
>> Signed-off-by: Misbah Anjum N <misanjum@linux.ibm.com>
>> Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
>> ---
>> tests/functional/ppc64/test_hv.py | 20 +++++++++++++++-----
>> 1 file changed, 15 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
>> index 8a1fca2cb1..d977038271 100755
>> --- a/tests/functional/ppc64/test_hv.py
>> +++ b/tests/functional/ppc64/test_hv.py
>> @@ -125,7 +125,12 @@ def do_test_kvm(self, hpt=False):
>> def test_hv_pseries(self):
>> self.require_accelerator("tcg")
>> self.require_netdev('user')
>> - self.set_machine('pseries')
>> + # Pin to pseries-8.2 (default CPU power9_v2.2) so that kvm-hv.ko inside
>> + # the L1 Alpine guest sees a POWER9 register set. The generic 'pseries'
>> + # alias resolves to pseries-11.2 (power11_v2.0) which Alpine's packaged
>> + # qemu-system-ppc64 does not recognise, causing the L2 "Register sync
>> + # failed" error. The L2 script passes '-cpu POWER9' to match.
>> + self.set_machine('pseries-8.2')
> If the guest needs POWER9, why not add a "-cpu POWER9" flag to the L1
> QEMU here, instead of making assumptions about what the machine type
> exposes.
>
> Using old versioned machine types in functional tests is undesirable
> as we automatically delete versioned machines after 6 years, at
> which point we'll need to address the CPU model choice anyway.
Noted - will take care of this in V2.
>
>> self.vm.add_args("-accel", "tcg,thread=multi")
>> self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
>> self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on")
>> @@ -135,10 +140,13 @@ def test_hv_pseries(self):
>> self.do_stop_alpine()
>>
>> def test_hv_pseries_kvm(self):
>> - self.require_accelerator("kvm")
>> + # L1 runs under TCG; L2 is launched with accel=kvm inside L1
>> + # (see do_test_kvm).
>> + self.require_accelerator("tcg")
>> self.require_netdev('user')
>> - self.set_machine('pseries')
>> - self.vm.add_args("-accel", "kvm")
>> + # Same CPU pinning rationale as test_hv_pseries above.
>> + self.set_machine('pseries-8.2')
>> + self.vm.add_args("-accel", "tcg,thread=multi")
>> self.vm.add_args('-device', 'nvme,serial=1234,drive=drive0')
>> self.vm.add_args("-machine", "x-vof=on,cap-nested-hv=on,cap-ccf-assist=off")
>> self.do_start_alpine()
>> @@ -149,7 +157,9 @@ def test_hv_pseries_kvm(self):
>> def test_hv_powernv(self):
>> self.require_accelerator("tcg")
>> self.require_netdev('user')
>> - self.set_machine('powernv')
>> + # Pin to powernv9 so the PCIe topology matches (pcie.0, pcie.2) and
>> + # kvm-hv.ko runs with the POWER9 CPU model.
>> + self.set_machine('powernv9')
>> self.vm.add_args("-accel", "tcg,thread=multi")
>> self.vm.add_args('-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234,drive=drive0',
>> '-device', 'e1000e,netdev=net0,mac=C0:FF:EE:00:00:02,bus=pcie.0,addr=0x0',
>> --
>> 2.52.0
>>
>>
> With regards,
> Daniel
Regards,
Aniket.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] tests/functional/ppc64: add kernel params and early panic detection
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
2026-11-20 9:58 ` [PATCH 1/5] tests/functional/ppc64: replace deprecated datetime.utcnow() Aniket Sahu
2026-11-20 9:58 ` [PATCH 2/5] tests/functional/ppc64: pin machine types for hypervisor tests Aniket Sahu
@ 2026-11-20 9:58 ` Aniket Sahu
2026-11-20 9:58 ` [PATCH 4/5] tests/functional/ppc64: dynamically resolve NVMe device path Aniket Sahu
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 9:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, peterx, farosas, npiggin, adityag, milesg, harshpb,
rathc, anushree.mathur, misanjum, gautam, thuth, amachhiw,
asahu1x
Add kernel command line parameters and improve error handling:
- Pass "console=hvc0 usbcore.nousb" on the L1 kernel command line
- Add early panic detection in do_test_kvm() with failure_message
- Retry apk update up to 5 times with 10 second delays
- Add debug logging at key steps (VM launch, login, apk update)
This allows the test to fail early if L2 panics instead of waiting
for the login prompt until timeout, and makes the Alpine setup more
robust against transient network issues.
Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
---
tests/functional/ppc64/test_hv.py | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
index d977038271..d983e5229c 100755
--- a/tests/functional/ppc64/test_hv.py
+++ b/tests/functional/ppc64/test_hv.py
@@ -63,16 +63,20 @@ def setUp(self):
self.initramfs = self.extract_from_iso(self.iso_path, '/boot/initramfs-lts')
def do_start_alpine(self):
+ self.log.debug("do_start_alpine: launching L1 VM")
self.vm.set_console()
- self.vm.add_args("-kernel", self.vmlinuz)
- self.vm.add_args("-initrd", self.initramfs)
- self.vm.add_args("-smp", "4", "-m", "2g")
- self.vm.add_args("-drive", f"file={self.iso_path},format=raw,if=none,"
- "id=drive0,read-only=true")
-
+ self.vm.add_args(
+ "-kernel", self.vmlinuz,
+ "-initrd", self.initramfs,
+ "-smp", "4", "-m", "2g",
+ "-drive", f"file={self.iso_path},format=raw,if=none,id=drive0,read-only=true",
+ "-append", "console=hvc0 usbcore.nousb",
+ )
self.vm.launch()
+ self.log.debug("do_start_alpine: VM launched, waiting for login prompt")
ps1='localhost:~#'
wait_for_console_pattern(self, 'localhost login:')
+ self.log.debug("do_start_alpine: got login prompt, logging in as root")
exec_command_and_wait_for_pattern(self, 'root', ps1)
self.log.debug("do_start_alpine: logged in, setting system clock")
# If the time is wrong, SSL certificates can fail.
@@ -80,8 +84,11 @@ def do_start_alpine(self):
exec_command_and_wait_for_pattern(self, cmd, ps1)
ps1='alpine:~#'
exec_command_and_wait_for_pattern(self, 'setup-alpine -qe', ps1)
- exec_command_and_wait_for_pattern(self, 'setup-apkrepos -c1', ps1)
- exec_command_and_wait_for_pattern(self, 'apk update', ps1)
+ exec_command_and_wait_for_pattern(
+ self,
+ 'for i in 1 2 3 4 5; do apk update && break; sleep 10; done',
+ ps1)
+ self.log.debug("do_start_alpine: apk update complete, Alpine L1 is ready")
# Could upgrade here but it usually should not be necessary
# exec_command_and_wait_for_pattern(self, 'apk upgrade --available', ps1)
@@ -114,9 +121,12 @@ def do_test_kvm(self, hpt=False):
'-kernel /media/nvme0n1/boot/vmlinuz-lts '
'-append \'usbcore.nousb ' + append + '\'')
# Alpine 3.21 kernel seems to crash in XHCI USB driver.
- ps1='localhost:~#'
- wait_for_console_pattern(self, 'localhost login:')
+ ps1 = 'localhost:~#'
+ wait_for_console_pattern(self, 'localhost login:',
+ failure_message=self.panic_message)
+ self.log.debug("do_test_kvm: L2 login prompt seen, logging in")
exec_command_and_wait_for_pattern(self, 'root', ps1)
+ self.log.debug("do_test_kvm: logged into L2, issuing poweroff")
exec_command(self, 'poweroff')
wait_for_console_pattern(self, 'reboot: Power down')
# Now wait for the host's prompt to come back
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/5] tests/functional/ppc64: dynamically resolve NVMe device path
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
` (2 preceding siblings ...)
2026-11-20 9:58 ` [PATCH 3/5] tests/functional/ppc64: add kernel params and early panic detection Aniket Sahu
@ 2026-11-20 9:58 ` Aniket Sahu
2026-11-20 9:58 ` [PATCH 5/5] tests/functional/ppc64: increase timeout for hypervisor tests Aniket Sahu
2026-11-20 16:06 ` [PATCH 0/5] tests/functional/ppc64: Fixes and improvements " Alex Bennée
5 siblings, 0 replies; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 9:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, peterx, farosas, npiggin, adityag, milesg, harshpb,
rathc, anushree.mathur, misanjum, gautam, thuth, amachhiw,
asahu1x
Do not hardcode the NVMe device name in L1 as it depends on the PCIe
topology of the machine type (e.g., pseries may enumerate it as nvme0n1
or nvme1n1).
Add _resolve_nvme_dev() method to query the kernel for the actual device
path, and write the L2 launch command to a script (/tmp/run-l2.sh) to
avoid terminal line-wrap breaking shell argument parsing.
Also add '-cpu POWER9' to the L2 QEMU command line to match what
kvm-hv.ko in L1 sees, and add comprehensive debug logging throughout
do_test_kvm() and do_setup_kvm().
Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
---
tests/functional/ppc64/test_hv.py | 87 +++++++++++++++++++++++++++----
1 file changed, 78 insertions(+), 9 deletions(-)
diff --git a/tests/functional/ppc64/test_hv.py b/tests/functional/ppc64/test_hv.py
index d983e5229c..567313fb6c 100755
--- a/tests/functional/ppc64/test_hv.py
+++ b/tests/functional/ppc64/test_hv.py
@@ -10,6 +10,7 @@
# later. See the COPYING file in the top-level directory.
import os
+import re
import subprocess
from datetime import datetime, timezone
@@ -100,9 +101,51 @@ def do_stop_alpine(self):
self.vm.wait()
def do_setup_kvm(self):
- ps1='alpine:~#'
+ self.log.debug("do_setup_kvm: installing qemu-system-ppc64 in L1")
+ ps1 = 'alpine:~#'
exec_command_and_wait_for_pattern(self, 'apk add qemu-system-ppc64', ps1)
+ self.log.debug("do_setup_kvm: qemu-system-ppc64 installed, loading kvm-hv")
exec_command_and_wait_for_pattern(self, 'modprobe kvm-hv', ps1)
+ self.log.debug("do_setup_kvm: kvm-hv module loaded")
+
+ def _resolve_nvme_dev(self):
+ """
+ Determine the NVMe block device path that the ISO is attached as
+ inside the L1 Alpine guest. The device name is not stable across
+ machine types (e.g. pseries may enumerate it as nvme0n1 or nvme1n1
+ depending on the PCIe bus topology), so we ask the kernel directly.
+
+ Returns the literal device path string, e.g. '/dev/nvme0n1', so
+ callers can bake it directly into shell scripts without any shell
+ variable scoping issues.
+ """
+ self.log.debug("_resolve_nvme_dev: probing NVMe device path in L1")
+ ps1 = 'alpine:~#'
+ # Print a clearly delimited marker and wait for the shell prompt so
+ # we accumulate all console bytes in one call — including any bytes
+ # that the terminal wraps across line boundaries.
+ out = exec_command_and_wait_for_pattern(
+ self,
+ 'echo "NVME_PATH:$(ls /dev/nvme?n1 | head -1)"',
+ ps1,
+ )
+ # Decode, strip ANSI escape sequences and newlines, then extract the
+ # path. Terminal line-wrap can split the token mid-string so we join
+ # all non-whitespace characters before matching.
+ text = out.decode('utf-8', errors='replace')
+ text = re.sub(r'\x1b\[[0-9;]*[A-Za-z]', '', text)
+ joined = ''.join(text.split())
+ # The joined string looks like: ...NVME_PATH:/dev/nvme0n1alpine:~#
+ m = re.search(r'NVME_PATH:(/dev/nvme\S+?)alpine', joined)
+ if not m:
+ m = re.search(r'NVME_PATH:(/dev/nvme\S+)', joined)
+ if m:
+ dev = m.group(1).rstrip('#~:').strip()
+ else:
+ dev = '/dev/nvme0n1'
+ self.log.debug("_resolve_nvme_dev: marker not found, using fallback")
+ self.log.debug("_resolve_nvme_dev: resolved device=%s", dev)
+ return dev
# This uses the host's block device as the source file for guest block
# device for install media. This is a bit hacky but allows reuse of the
@@ -110,16 +153,40 @@ def do_setup_kvm(self):
def do_test_kvm(self, hpt=False):
if hpt:
append = 'disable_radix'
+ self.log.debug("do_test_kvm: launching L2 in HPT mode")
else:
append = ''
- exec_command(self, 'qemu-system-ppc64 -nographic -smp 2 -m 1g '
- '-machine pseries,x-vof=on,accel=kvm '
- '-machine cap-cfpc=broken,cap-sbbc=broken,'
- 'cap-ibs=broken,cap-ccf-assist=off '
- '-drive file=/dev/nvme0n1,format=raw,readonly=on '
- '-initrd /media/nvme0n1/boot/initramfs-lts '
- '-kernel /media/nvme0n1/boot/vmlinuz-lts '
- '-append \'usbcore.nousb ' + append + '\'')
+ self.log.debug("do_test_kvm: launching L2 in Radix mode (default)")
+
+ # Resolve the NVMe device path inside the L1 guest first so we do
+ # not hardcode a path that may differ by machine type.
+ nvme_dev = self._resolve_nvme_dev()
+
+ # Write the L2 launch command to a script to avoid terminal line-wrap
+ # breaking shell argument parsing, and to keep individual lines short.
+ # nvme_dev is the literal path, e.g. /dev/nvme0n1 — bake it in.
+ mnt = f'/media/$(basename {nvme_dev})'
+ ps1 = 'alpine:~#'
+ l2_script = [
+ ("cat > /tmp/run-l2.sh << 'EOF'", '>'),
+ ('#!/bin/sh', '>'),
+ ('qemu-system-ppc64 -nographic \\', '>'),
+ (' -smp 2 -m 1g \\', '>'),
+ (' -cpu POWER9 \\', '>'),
+ (' -machine pseries,x-vof=on,accel=kvm \\', '>'),
+ (' -machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off \\', '>'),
+ (f' -drive file={nvme_dev},format=raw,readonly=on \\', '>'),
+ (f' -initrd {mnt}/boot/initramfs-lts \\', '>'),
+ (f' -kernel {mnt}/boot/vmlinuz-lts \\', '>'),
+ (f' -append "usbcore.nousb {append}"', '>'),
+ ('EOF', ps1),
+ ('chmod +x /tmp/run-l2.sh', ps1),
+ ]
+ for cmd, expected_pattern in l2_script:
+ exec_command_and_wait_for_pattern(self, cmd, expected_pattern)
+ self.log.debug("do_test_kvm: L2 launch script written, executing")
+ exec_command(self, '/tmp/run-l2.sh')
+ self.log.debug("do_test_kvm: L2 QEMU launched, waiting for L2 login prompt")
# Alpine 3.21 kernel seems to crash in XHCI USB driver.
ps1 = 'localhost:~#'
wait_for_console_pattern(self, 'localhost login:',
@@ -129,8 +196,10 @@ def do_test_kvm(self, hpt=False):
self.log.debug("do_test_kvm: logged into L2, issuing poweroff")
exec_command(self, 'poweroff')
wait_for_console_pattern(self, 'reboot: Power down')
+ self.log.debug("do_test_kvm: L2 powered down, waiting for L1 prompt")
# Now wait for the host's prompt to come back
wait_for_console_pattern(self, 'alpine:~#')
+ self.log.debug("do_test_kvm: L1 prompt restored")
def test_hv_pseries(self):
self.require_accelerator("tcg")
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/5] tests/functional/ppc64: increase timeout for hypervisor tests
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
` (3 preceding siblings ...)
2026-11-20 9:58 ` [PATCH 4/5] tests/functional/ppc64: dynamically resolve NVMe device path Aniket Sahu
@ 2026-11-20 9:58 ` Aniket Sahu
2026-11-20 16:06 ` [PATCH 0/5] tests/functional/ppc64: Fixes and improvements " Alex Bennée
5 siblings, 0 replies; 9+ messages in thread
From: Aniket Sahu @ 2026-11-20 9:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, peterx, farosas, npiggin, adityag, milesg, harshpb,
rathc, anushree.mathur, misanjum, gautam, thuth, amachhiw,
asahu1x
Increase the timeout for test_hv.py from 1000 to 6000 seconds.
The test now takes much longer due to:
- Retrying apk update up to 5 times
- More comprehensive testing with additional debug logging
Signed-off-by: Misbah Anjum N <misanjum@linux.ibm.com>
Signed-off-by: Aniket Sahu <asahu1x@linux.ibm.com>
---
tests/functional/ppc64/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/functional/ppc64/meson.build b/tests/functional/ppc64/meson.build
index cb3c745624..d908786426 100644
--- a/tests/functional/ppc64/meson.build
+++ b/tests/functional/ppc64/meson.build
@@ -2,7 +2,7 @@
test_ppc64_timeouts = {
'fadump' : 480,
- 'hv' : 1000,
+ 'hv' : 6000,
'mac99' : 120,
'openbsd' : 240,
'powernv' : 480,
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests
2026-11-20 9:58 [PATCH 0/5] tests/functional/ppc64: Fixes and improvements for hypervisor tests Aniket Sahu
` (4 preceding siblings ...)
2026-11-20 9:58 ` [PATCH 5/5] tests/functional/ppc64: increase timeout for hypervisor tests Aniket Sahu
@ 2026-11-20 16:06 ` Alex Bennée
5 siblings, 0 replies; 9+ messages in thread
From: Alex Bennée @ 2026-11-20 16:06 UTC (permalink / raw)
To: Aniket Sahu
Cc: qemu-devel, qemu-ppc, peterx, farosas, npiggin, adityag, milesg,
harshpb, rathc, anushree.mathur, misanjum, gautam, thuth,
amachhiw
Aniket Sahu <asahu1x@linux.ibm.com> writes:
> This series fixes several issues in the PPC64 hypervisor functional tests
> and improves their robustness and reliability.
Just a quick note to say the power hardware we have from OSUL doesn't
expose a hypervisor so we can't currently run these tests in the
upstream CI. Do you know of any way we could get such hardware added to
the CI?
Also I should note it would be nice to get:
https://gitlab.com/qemu-project/qemu/-/work_items/3207
addressed. Let me know if you need access to the system.
>
> Changes in this series:
> -----------------------
>
> 1. Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)
> to avoid deprecation warnings in Python 3.12+.
>
> 2. Pin machine types to avoid CPU compatibility issues between the L0
> QEMU (which now defaults to power11) and the L1 Alpine guest's
> packaged QEMU (which doesn't recognize power11). This fixes
> "Register sync failed" errors in L2.
>
> 3. Add kernel command line parameters (console=hvc0 usbcore.nousb) and
> early panic detection to fail fast when L2 encounters issues, plus
> retry logic for apk update to handle transient network failures.
>
> 4. Dynamically resolve the NVMe device path in L1 instead of hardcoding
> it, as the device name varies by machine type (nvme0n1 vs nvme1n1).
> Also adds comprehensive debug logging throughout the test flow and
> writes the L2 launch command to a script to avoid terminal line-wrap
> issues.
>
> 5. Increase the test timeout from 1000 to 6000 seconds to accommodate
> the longer runtime due to apk update retries and additional testing.
>
> Testing:
> --------
> All tests pass on our PPC64 test machines running Ubuntu 26.04 in an
> LPAR.
>
> Aniket Sahu (3):
> tests/functional/ppc64: replace deprecated datetime.utcnow()
> tests/functional/ppc64: add kernel params and early panic detection
> tests/functional/ppc64: dynamically resolve NVMe device path
>
> Misbah Anjum N (2):
> tests/functional/ppc64: pin machine types for hypervisor tests
> tests/functional/ppc64: increase timeout for hypervisor tests
>
> tests/functional/ppc64/meson.build | 2 +-
> tests/functional/ppc64/test_hv.py | 140 +++++++++++++++++++++++++----
> 2 files changed, 117 insertions(+), 25 deletions(-)
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 9+ messages in thread