Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64

Marek Marczykowski-Górecki <[email protected]> Tue, 4 Aug 2026 21:17:32 +0200
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <anI6zLWzX8kDi7oC@mail-itl>
--hQuFwtfgOO6JM1Yo
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Date: Tue, 4 Aug 2026 21:17:32 +0200
From: Marek =?utf-8?B?PT91dGYtOD9RP01hcmN6eWtvd3NraS1HPUMzPUIzcmVja2k/PQ==?= <[email protected]>
To: Andrew Cooper <[email protected]>
Cc: Frediano Ziglio <[email protected]>, [email protected],
	Frediano Ziglio <[email protected]>,
	Doug Goldstein <[email protected]>,
	Stefano Stabellini <[email protected]>,
	Jan Beulich <[email protected]>
Subject: Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of
 qemu-alpine-x86_64

On Tue, Aug 04, 2026 at 07:55:24PM +0100, Andrew Cooper wrote:
> On 04/08/2026 7:48 pm, Frediano Ziglio wrote:
> > On Tue, 4 Aug 2026 at 18:57, Marek Marczykowski-G=C3=B3recki
> > <[email protected]> wrote:
> >> On Tue, Aug 04, 2026 at 06:42:18PM +0100, Frediano Ziglio wrote:
> >>> Make sure that save/restore continue to work.
> >>> The check save and restore twice to check for corrupted status.
> >>> Also a command is launched in the guest to make sure that the
> >>> machine is not crashed but working.
> >>>
> >>> Signed-off-by: Frediano Ziglio <[email protected]>
> >>> ---
> >>>  automation/scripts/console.exp           |  8 +++++
> >>>  automation/scripts/qemu-alpine-x86_64.sh | 40 ++++++++++++++++++++++=
--
> >>>  2 files changed, 46 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/automation/scripts/console.exp b/automation/scripts/cons=
ole.exp
> >>> index e27886bbef..ff58ed29b8 100755
> >>> --- a/automation/scripts/console.exp
> >>> +++ b/automation/scripts/console.exp
> >>> @@ -58,6 +58,14 @@ if {[info exists env(WAKEUP_CMD)]} {
> >>>      system "$env(WAKEUP_CMD)"
> >>>  }
> >>>
> >>> +if {[info exists env(EXPECT_TEXTS)]} {
> >>> +    set lines [split "$env(EXPECT_TEXTS)" "\n"]
> >>> +    foreach {exp snd} $lines {
> >>> +        expect -re "$exp"
> >>> +        send "$snd\n"
> >>> +    }
> >>> +}
> >>> +
> >>>  if {[info exists env(LOG_MSG)]} {
> >>>      expect {
> >>>          -notransfer -re "$env(PASSED)" {
> >>> diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/sc=
ripts/qemu-alpine-x86_64.sh
> >>> index 60f5cc49fc..409a601c34 100755
> >>> --- a/automation/scripts/qemu-alpine-x86_64.sh
> >>> +++ b/automation/scripts/qemu-alpine-x86_64.sh
> >>> @@ -48,6 +48,28 @@ xl -vvv create -c /root/domU.cfg
> >>>
> >>>  " > etc/local.d/xen.start
> >>>  chmod +x etc/local.d/xen.start
> >>> +
> >>> +# Script to test save and restore.
> >>> +# It saves and restores domU domain twice to check if the domain was=
 corrupted
> >>> +# during the first sequence.
> >>> +# At the end open the console to check if the domain is working.
> >>> +cat > root/save_restore_test << "EOF"
> >>> +#!/bin/sh
> >>> +set -ex
> >>> +xl list | grep -q domU
> >>> +rm -f save.dat
> >>> +xl save "$(xl list | awk '$1=3D=3D"domU" { print $2 }')" save.dat /r=
oot/domU.cfg
> >>> +xl restore /root/domU.cfg save.dat
> >>> +xl list | grep -q domU
> >>> +rm -f save.dat
> >>> +xl save "$(xl list | awk '$1=3D=3D"domU" { print $2 }')" save.dat /r=
oot/domU.cfg
> >>> +xl restore /root/domU.cfg save.dat
> >>> +xl list | grep -q domU
> >>> +rm -f save.dat
> >>> +xl console "$(xl list | awk '$1=3D=3D"domU" { print $2 }')"
> >>> +EOF
> >>> +chmod +x root/save_restore_test
> >>> +
> >>>  find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz
> >>>  cd ../..
> >>>
> >>> @@ -70,9 +92,23 @@ export TEST_CMD=3D"qemu-system-x86_64 \
> >>>      -device virtio-net-pci,netdev=3Dn0 \
> >>>      -netdev user,id=3Dn0,tftp=3Dbinaries,bootfile=3D/pxelinux.0"
> >>>
> >>> +# Sequence of expect/send strings:
> >>> +# 1. wait domain start and close console;
> >>> +# 2. wait login prompt and login as root
> >>> +# 3. wait login and launch save/restore test;
> >>> +# 4. wait restore from domain console and send a command.
> >> Why doing this interactively over serial, instead of adding to
> >> etc/local.d/xen.start and then printing test result at the end?
> >>
> > I'm using expect to interact with the console. expect is not available
> > inside the alpine root filesystem.
> > Some failure I had during migration is that the VM crashed. In the
> > script I interact with the console to check that the VM is still able
> > to run commands.
>=20
> We can add `expect` to the dom0 root filesystem if we find a need for
> it, and it looks like this might be a good enough reason.=C2=A0 You want a
> patch to https://gitlab.com/xen-project/hardware/test-artifacts
> images/alpine/*-x86_64-base.dockerfile to get it included.

FWIW, my suspend test (which tests a similar thing) uses ping to check
if domU is still alive:
https://gitlab.com/xen-project/people/marmarek/xen/-/blob/2184be51d426b60f5=
e1a7e6e891d0f40e9488fc7/automation/scripts/qemu-alpine-domU-suspend-x86_64.=
sh


> But, for migration testing, this really wants to run on the real
> hardware.=C2=A0 Besides the main memory image, there's variations in regi=
ster
> state and validity which will vary between hardware.

--=20
Best Regards,
Marek Marczykowski-G=C3=B3recki
Invisible Things Lab

--hQuFwtfgOO6JM1Yo
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmpyOswACgkQ24/THMrX
1yyZZwgAk+x0JJUH7L6xO6AueJRPcm/8FB/EEIhmJn9UTrsz/AArwo1pHd24NhAn
vDwM5cw4bkNAo8qqm9wkVI1UctRLdrR1yoj9nebEosm9969h5W8QfqX1BEZfjeB4
FcRVypbfDHXoeWRhA9f/k9Ixz/LAVxRbCmc3steaE8bGnnGH/U2K3zbqWYvXSDSF
yNR2qQizmZpASTAdaeQv8ann8hfz7mqDAYMhfuAQ0iPn8GxzaksoYKlflr68nJd6
ZichuKBc4Vwjtp/8odC1uDEnYEwnbKxmQumnduCUcDi98ZZ8vjy9xOGeTkAzxYS6
fdDSeGVaCnX6PnruOVJtv85ohK9bUg==
=lREV
-----END PGP SIGNATURE-----

--hQuFwtfgOO6JM1Yo--