CI: Check save/restore, minor style update
cover CI: Check save/restore, minor style update
Main change is the second commit implementing a test for save and restore. First commit is just a style change to reduce number of commands (and lines).
Frediano Ziglio (2):
CI: Simplify directories creation
CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
automation/scripts/console.exp | 8 ++++ automation/scripts/qemu-alpine-x86_64.sh | 51 ++++++++++++++++++------ 2 files changed, 47 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 CI: Simplify directories creation
Use a single command.
--- automation/scripts/qemu-alpine-x86_64.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
automation/scripts/qemu-alpine-x86_64.sh +1 -10
@@ -4,16 +4,7 @@ set -ex -o pipefail # DomU Busybox cd binaries -mkdir -p initrd -mkdir -p initrd/bin -mkdir -p initrd/sbin -mkdir -p initrd/etc -mkdir -p initrd/dev -mkdir -p initrd/proc -mkdir -p initrd/sys -mkdir -p initrd/lib -mkdir -p initrd/var -mkdir -p initrd/mnt +mkdir -p initrd/{bin,sbin,etc,dev,proc,sys,lib,var,mnt} cp /bin/busybox initrd/bin/busybox initrd/bin/busybox --install initrd/bin echo "#!/bin/sh
Signature · 1 line
2.43.0
Re: [PATCH 1/2] CI: Simplify directories creation
Quoted 9 lines · Frediano Ziglio
automation/scripts/qemu-alpine-x86_64.sh +0
-1@@ -4,16 +4,7 @@ set -ex -o pipefail # DomU Busybox cd binaries -mkdir -p initrd
automation/scripts/qemu-alpine-x86_64.sh set -ex -o pipefail · line 7
Quoted 10 lines
automation/scripts/qemu-alpine-x86_64.sh +1
-9-mkdir -p initrd/bin -mkdir -p initrd/sbin -mkdir -p initrd/etc -mkdir -p initrd/dev -mkdir -p initrd/proc -mkdir -p initrd/sys -mkdir -p initrd/lib -mkdir -p initrd/var -mkdir -p initrd/mnt +mkdir -p initrd/{bin,sbin,etc,dev,proc,sys,lib,var,mnt}
This makes it really hard to find out if more directory or less directory are been created. When reviewing a patch, we don't see what changed in a line without using more complex tools.
For this patch, I have now idea at a glimpse if all the directory that was created before are still created.
In the future, we might need to create more directories, this would change on very long line to another, and make it hard to find out what was the logical change, by just looking at the output of diff -u.
So I don't see this patch as an improvement.
But that just my opinion, but that would apply equally to other similar changes, like packing all the variable declaration on a single line in C.
Cheers,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
Re: [PATCH 1/2] CI: Simplify directories creation
Quoted 33 lines · Anthony PERARD
Quoted 9 lines · Frediano Ziglio
automation/scripts/qemu-alpine-x86_64.sh +0
-1@@ -4,16 +4,7 @@ set -ex -o pipefail # DomU Busybox cd binaries -mkdir -p initrdautomation/scripts/qemu-alpine-x86_64.sh set -ex -o pipefail · line 7
Quoted 10 lines
automation/scripts/qemu-alpine-x86_64.sh +1
-9-mkdir -p initrd/bin -mkdir -p initrd/sbin -mkdir -p initrd/etc -mkdir -p initrd/dev -mkdir -p initrd/proc -mkdir -p initrd/sys -mkdir -p initrd/lib -mkdir -p initrd/var -mkdir -p initrd/mnt +mkdir -p initrd/{bin,sbin,etc,dev,proc,sys,lib,var,mnt}This makes it really hard to find out if more directory or less directory are been created. When reviewing a patch, we don't see what changed in a line without using more complex tools.
For this patch, I have now idea at a glimpse if all the directory that was created before are still created.
In the future, we might need to create more directories, this would change on very long line to another, and make it hard to find out what was the logical change, by just looking at the output of
diff -u.
Quoted 7 lines
So I don't see this patch as an improvement.
But that just my opinion, but that would apply equally to other similar changes, like packing all the variable declaration on a single line in C.
Cheers,
Hi,
what about putting the directory names in alphabetical order?
Either in multiline or in the concise single line?
In both cases it makes it easier to check if it's already there.
Or something like
mkdir -p binaries/initrd
cd binaries/initrd
mkdir -p \
bin \
dev \
etc \
lib \
mnt \
proc \
sbin \
sys \
varcd ..
Regards,
Frediano
PATCH 2/2 CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
In reply to Frediano ZiglioMake 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.
--- automation/scripts/console.exp | 8 +++++ automation/scripts/qemu-alpine-x86_64.sh | 40 ++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-)
automation/scripts/console.exp +8 -0
@@ -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)" {
automation/scripts/qemu-alpine-x86_64.sh +38 -2
@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/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. +gs=$'\x1d' +export EXPECT_TEXTS="BusyBox +$gs $gs +login: +root +login on +/root/save_restore_test +Restarting tasks +dmesg | grep suspending | tr o 0" + export TEST_LOG="smoke.serial" export BOOT_MSG="Latest ChangeSet: " -export LOG_MSG="Domain-0" -export PASSED="BusyBox" +export PASSED="suspending xenst0re" ./automation/scripts/console.exp |& sed 's/\r\+$//'
Signature · 1 line
2.43.0
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 64 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="domU" { print $2 }')" +EOF +chmod +x root/save_restore_test + find . | cpio -R 0:0 -H newc -o | gzip >> ../dom0-rootfs.cpio.gz cd ../..
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 8 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-0@@ -70,9 +92,23 @@ export TEST_CMD="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/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?
Quoted 20 lines
automation/scripts/qemu-alpine-x86_64.sh +11
-2+gs=$'\x1d' +export EXPECT_TEXTS="BusyBox +$gs $gs +login: +root +login on +/root/save_restore_test +Restarting tasks +dmesg | grep suspending | tr o 0" + export TEST_LOG="smoke.serial" export BOOT_MSG="Latest ChangeSet: " -export LOG_MSG="Domain-0" -export PASSED="BusyBox" +export PASSED="suspending xenst0re" ./automation/scripts/console.exp |& sed 's/\r\+$//'Signature · 1 line
2.43.0
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 69 lines · Marek Marczykowski-Górecki
Quoted 67 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
Quoted 9 lines
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 5 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-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.
Quoted 25 lines
Quoted 18 lines
automation/scripts/qemu-alpine-x86_64.sh +11
-3+gs=$'\x1d' +export EXPECT_TEXTS="BusyBox +$gs $gs +login: +root +login on +/root/save_restore_test +Restarting tasks +dmesg | grep suspending | tr o 0" + export TEST_LOG="smoke.serial" export BOOT_MSG="Latest ChangeSet: " -export LOG_MSG="Domain-0" -export PASSED="BusyBox" +export PASSED="suspending xenst0re" ./automation/scripts/console.exp |& sed 's/\r\+$//' --Quoted 2 lines
2.43.0
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 78 lines · Frediano Ziglio
Quoted 68 lines · Marek Marczykowski-Górecki
Quoted 67 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"Quoted 8 lines
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 5 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-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?
Quoted 5 lines
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.
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. You want a patch to https://gitlab.com/xen-project/hardware/test-artifacts
images/alpine/*-x86_64-base.dockerfile to get it included.
But, for migration testing, this really wants to run on the real hardware. Besides the main memory image, there's variations in register state and validity which will vary between hardware.
~Andrew
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 85 lines · Andrew Cooper
Quoted 78 lines · Frediano Ziglio
Quoted 68 lines · Marek Marczykowski-Górecki
Quoted 67 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"Quoted 8 lines
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 5 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-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?
Quoted 5 lines
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.
Quoted 4 lines
We can add
expectto the dom0 root filesystem if we find a need for it, and it looks like this might be a good enough reason. 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/2184be51d426b60f5e1a7e6e891d0f40e9488fc7/automation/scripts/qemu-alpine-domU-suspend-x86_64.sh
Quoted 3 lines
But, for migration testing, this really wants to run on the real hardware. Besides the main memory image, there's variations in register state and validity which will vary between hardware.
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 87 lines · Marek Marczykowski-Górecki
Quoted 85 lines · Andrew Cooper
Quoted 83 lines · Frediano Ziglio
Quoted 68 lines · Marek Marczykowski-Górecki
Quoted 67 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"Quoted 8 lines
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 5 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-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.
Quoted 9 lines
Quoted 4 lines
We can add
expectto the dom0 root filesystem if we find a need for it, and it looks like this might be a good enough reason. 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/2184be51d426b60f5e1a7e6e891d0f40e9488fc7/automation/scripts/qemu-alpine-domU-suspend-x86_64.sh
Are you going to upstream the test?
Why sleep between commands? Worrying about possible races? Probably there should be no race after the command exited so I personally would remove.
Using the network seems like a good idea. I also discovered that there is nc and bash installed so something like
# nc -lk -p 8888 -e sh -c "echo Still alive"
and
# bash -c 'read -t 1 line < /dev/tcp/localhost/8888; echo $line'
Still alivewould even test if userspace is still working correctly
Quoted 5 lines
Quoted 4 lines
But, for migration testing, this really wants to run on the real hardware. Besides the main memory image, there's variations in register state and validity which will vary between hardware.
Which scripts/jobs are run on real hardware (well, I suppose all that starts with zen, kbl, xilink or adl). Are they all run for every build?
--
Frediano
Re: [PATCH 2/2] CI: Check save/restore of PV domain as part of qemu-alpine-x86_64
Quoted 94 lines · Frediano Ziglio
Quoted 92 lines · Marek Marczykowski-Górecki
Quoted 89 lines · Andrew Cooper
Quoted 78 lines · Frediano Ziglio
Quoted 68 lines · Marek Marczykowski-Górecki
Quoted 67 lines · Frediano Ziglio
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(-)automation/scripts/console.exp +8
-0@@ -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)" {automation/scripts/qemu-alpine-x86_64.sh +22
-0@@ -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=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl save "$(xl list | awk '$1=="domU" { print $2 }')" save.dat /root/domU.cfg +xl restore /root/domU.cfg save.dat +xl list | grep -q domU +rm -f save.dat +xl console "$(xl list | awk '$1=="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="qemu-system-x86_64 \ -device virtio-net-pci,netdev=n0 \ -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"Quoted 8 lines
automation/scripts/qemu-alpine-x86_64.sh export TEST_CMD="qemu-system-x86_64 \ · line 99
Quoted 5 lines
automation/scripts/qemu-alpine-x86_64.sh +5
-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?
Quoted 5 lines
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.We can add
expectto the dom0 root filesystem if we find a need for it, and it looks like this might be a good enough reason. You want a patch to https://gitlab.com/xen-project/hardware/test-artifacts
images/alpine/*-x86_64-base.dockerfile to get it included.
Quoted 6 lines
Quoted 4 lines
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/2184be51d426b60f5e1a7e6e891d0f40e9488fc7/automation/scripts/qemu-alpine-domU-suspend-x86_64.shAre you going to upstream the test?
Yes, this branch (including a few more tests) waits for the other series to test-artifacts (already acked) to be pushed. Otherwise, it needs a hack with switching to alternative repos to work...
I guess I can post it anyway, just with a disclaimer about pushing order...
Quoted 3 lines
Why sleep between commands? Worrying about possible races? Probably there should be no race after the command exited so I personally would remove.
To cover also cases where crash happens only a moment later, not in the very second it's resumed. I had also a case where only one vcpu crashed, but otherwise domU appeared functional (this I solved with oops=panic on kernel cmdline, added in an earlier commit).
Quoted 11 lines
Using the network seems like a good idea. I also discovered that there is nc and bash installed so something like
# nc -lk -p 8888 -e sh -c "echo Still alive"and
# bash -c 'read -t 1 line < /dev/tcp/localhost/8888; echo $line' Still alivewould even test if userspace is still working correctly
Looks like a good idea.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
But, for migration testing, this really wants to run on the real hardware. Besides the main memory image, there's variations in register state and validity which will vary between hardware.
Which
scripts/jobsare run on real hardware (well, I suppose all that starts with zen, kbl, xilink or adl). Are they all run for every build?
Yes.
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab