Improve reliability of VM tests
v2 cover Improve reliability of VM tests
This patch series attempts to improve the reliability of several of the VM test targets. In particular, both CentOS 8 tests are non-functional because CentOS 8 was EOL at the beginning of this calendar year, with repositories and mirrors going offline.
Notably, I also remove the ubuntu.i386 test because we no longer support Ubuntu 18.04 nor do we have explicit need of an i386 build test.
After this series, I am able to successfully run every VM target on an x86_64 host, except:
- ubuntu.aarch64: Hangs often during testing, see below.
- centos.aarch64: Hangs often during testing, see below.
- haiku.x86_64: Build failures not addressed by this series, see
https://lists.gnu.org/archive/html/qemu-devel/2022-06/msg02103.html
The unit tests that I see fail most often are:
- qom-test: ENOMEM with default config and many cores
- test-hmp: ENOMEM with default config and many cores
- virtio-net-failover: Seems to like to hang on openbsd
- migration-test: Tends to hang under aarch64 tcg
Increasing the default memory (patch 10) has seemingly helped both reliability *and* reduced race conditions quite a bit, both on my 12-thread intel laptop and on my 32-thread AMD 5950x desktop.
Due to how long it takes to run these tests, though, I can't claim perfect reliability. The flakiness of virtio-net-failover and migration-test is something that probably still needs to be addressed, but it's outside of my expertise and time budget at present to pursue it.
Future work (next version? next series?);
- Try to get centos.aarch64 working reliably under TCG
- Upgrade ubuntu.aarch64 to 20.04 after fixing centos.aarch64
- Fix the Haiku build test, if possible.
- Ensure I can reliably run and pass "make vm-build-all". (Remove VMs from this recipe if necessary.)
John Snow (10):
tests/qemu-iotests: hotfix for 307, 223 output tests/qemu-iotests: skip 108 when FUSE is not loaded
qga: treat get-guest-fsinfo as "best effort" tests/vm: use 'cp' instead of 'ln' for temporary vm images tests/vm: switch CentOS 8 to CentOS 8 Stream tests/vm: switch centos.aarch64 to CentOS 8 Stream tests/vm: update sha256sum for ubuntu.aarch64 tests/vm: remove ubuntu.i386 VM test
tests/vm: remove duplicate 'centos' VM test tests/vm: add 512MB extra memory per core
qga/commands-posix.c | 8 +- tests/qemu-iotests/108 | 5 ++ tests/qemu-iotests/223.out | 4 +- tests/qemu-iotests/307.out | 4 +- tests/vm/Makefile.include | 5 +- tests/vm/basevm.py | 6 ++ tests/vm/centos | 8 +- tests/vm/centos.aarch64 | 174 +++++-------------------------------- tests/vm/ubuntu.aarch64 | 8 +- tests/vm/ubuntu.i386 | 40 --------- 10 files changed, 58 insertions(+), 204 deletions(-) delete mode 100755 tests/vm/ubuntu.i386
Signature · 1 line
2.34.3
PATCH v2 1/10 tests/qemu-iotests: hotfix for 307, 223 output
--- tests/qemu-iotests/223.out | 4 ++-- tests/qemu-iotests/307.out | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tests/qemu-iotests/223.out +2 -2
@@ -93,7 +93,7 @@ exports available: 3 export: 'n2' description: some text size: 4194304 - flags: 0xced ( flush fua trim zeroes df cache fast-zero ) + flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) min block: 1 opt block: 4096 max block: 33554432
@@ -212,7 +212,7 @@ exports available: 3 export: 'n2' description: some text size: 4194304 - flags: 0xced ( flush fua trim zeroes df cache fast-zero ) + flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) min block: 1 opt block: 4096 max block: 33554432
tests/qemu-iotests/307.out +2 -2
@@ -83,7 +83,7 @@ exports available: 2 export: 'export1' description: This is the writable second export size: 67108864 - flags: 0xced ( flush fua trim zeroes df cache fast-zero ) + flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) min block: XXX opt block: XXX max block: XXX
@@ -109,7 +109,7 @@ exports available: 1 export: 'export1' description: This is the writable second export size: 67108864 - flags: 0xced ( flush fua trim zeroes df cache fast-zero ) + flags: 0xded ( flush fua trim zeroes df multi cache fast-zero ) min block: XXX opt block: XXX max block: XXX
Signature · 1 line
2.34.3
Re: [PATCH v2 01/10] tests/qemu-iotests: hotfix for 307, 223 output
Quoted 8 lines · John Snow
Fixes 58a6fdccSigned-off-by John Snow <[email protected]>Tested-by Daniel P. Berrangé <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>--- tests/qemu-iotests/223.out | 4 ++-- tests/qemu-iotests/307.out | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
PATCH v2 2/10 tests/qemu-iotests: skip 108 when FUSE is not loaded
In reply to John SnowIn certain container environments we may not have FUSE at all, so skip the test in this circumstance too.
--- tests/qemu-iotests/108 | 5 +++++ 1 file changed, 5 insertions(+)
tests/qemu-iotests/108 +5 -0
@@ -60,6 +60,11 @@ if sudo -n losetup &>/dev/null; then else loopdev=false + # Check for usable FUSE in the host environment: + if test ! -c "/dev/fuse"; then + _notrun 'No passwordless sudo nor usable /dev/fuse' + fi + # QSD --export fuse will either yield "Parameter 'id' is missing" # or "Invalid parameter 'fuse'", depending on whether there is # FUSE support or not.
Signature · 1 line
2.34.3
Re: [PATCH v2 02/10] tests/qemu-iotests: skip 108 when FUSE is not loaded
Quoted 14 lines · John Snow
In certain container environments we may not have FUSE at all, so skip the test in this circumstance too.
Signed-off-by John Snow <[email protected]>--- tests/qemu-iotests/108 | 5 +++++ 1 file changed, 5 insertions(+)tests/qemu-iotests/108 +0
-0@@ -60,6 +60,11 @@ if sudo -n losetup &>/dev/null; then else
tests/qemu-iotests/108 if sudo -n losetup &>/dev/null; then · line 70
Quoted 10 lines
tests/qemu-iotests/108 +5
-0loopdev=false + # Check for usable FUSE in the host environment: + if test ! -c "/dev/fuse"; then + _notrun 'No passwordless sudo nor usable /dev/fuse' + fi + # QSD --export fuse will either yield "Parameter 'id' is missing" # or "Invalid parameter 'fuse'", depending on whether there is # FUSE support or not.
Re: [PATCH v2 02/10] tests/qemu-iotests: skip 108 when FUSE is not loaded
In reply to John SnowQuoted 7 lines · John Snow
In certain container environments we may not have FUSE at all, so skip the test in this circumstance too.
Signed-off-by John Snow <[email protected]>--- tests/qemu-iotests/108 | 5 +++++ 1 file changed, 5 insertions(+)
Re: [PATCH v2 02/10] tests/qemu-iotests: skip 108 when FUSE is not loaded
Quoted 5 lines · Hanna Reitz
Quoted 3 lines · John Snow
In certain container environments we may not have FUSE at all, so skip the test in this circumstance too.
Quoted 7 lines
Quoted 4 lines
Signed-off-by John Snow <[email protected]>--- tests/qemu-iotests/108 | 5 +++++ 1 file changed, 5 insertions(+)Reviewed-by Hanna Reitz <[email protected]>
Hanna, if you want to take just the first two, be my guest. The rest of this series needs more work still.
--js
Re: [PATCH v2 02/10] tests/qemu-iotests: skip 108 when FUSE is not loaded
Quoted 5 lines · John Snow
Quoted 4 lines · Hanna Reitz
Quoted 3 lines · John Snow
In certain container environments we may not have FUSE at all, so skip the test in this circumstance too.
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Signed-off-by John Snow <[email protected]>--- tests/qemu-iotests/108 | 5 +++++ 1 file changed, 5 insertions(+)Reviewed-by Hanna Reitz <[email protected]>Hanna, if you want to take just the first two, be my guest.
Thanks for the invite, always happy to be your guest!
(Applied to my block branch:)
https://gitlab.com/hreitz/qemu/-/commits/block
Hanna
PATCH v2 3/10 qga: treat get-guest-fsinfo as "best effort"
In reply to John SnowIn some container environments, there may be references to block devices witnessable from a container through /proc/self/mountinfo that reference devices we simply don't have access to in the container, and could not provide information about.
Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
qga/commands-posix.c +7 -1
@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath, syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, etc. */ +fprintf (stderr,"realpath(%s) returned NULL/ENOENT\n" , devpath); + fs->name =g_strdup ("??\?-ENOENT" ); + }else { +error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); + }return ; }
Signature · 1 line
2.34.3
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
Hi
Quoted 28 lines · John Snow
In some container environments, there may be references to block devices witnessable from a container through
/proc/self/mountinfothat reference devices we simply don't have access to in the container, and could not provide information about.Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +2
-1@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath, syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config,
Quoted 4 lines
etc. */
+ fprintf(stderr, "realpath(%s) returned NULL/ENOENT\n",
devpath);
qga uses g_critical() (except for some win32 code paths atm)
Quoted 2 lines
+
fs->name=g_strdup("??\?-ENOENT");
Hmm, maybe we should make the field optional instead.
Quoted 11 lines
qga/commands-posix.c +3
-1+ }else { +error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); + }return ; } --2.34.3
Signature · 1 line
Marc-André Lureau
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
Quoted 27 lines · Marc-André Lureau
Hi
Quoted 23 lines · John Snow
In some container environments, there may be references to block devices witnessable from a container through
/proc/self/mountinfothat reference devices we simply don't have access to in the container, and could not provide information about.Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +0
-0@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath,
Quoted 9 lines
qga/commands-posix.c static void build_guest_fsinfo_for_device(char const *devpath, · line 1212
Quoted 6 lines
qga/commands-posix.c +3
-1syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, etc. */ +fprintf (stderr,"realpath(%s) returned NULL/ENOENT\n" , devpath);qga uses
g_critical()(except for some win32 code paths atm)
Whoops, this is a debugging thing that I left in by accident. I was just so excited that after testing overnight, everything worked. :)
Quoted 6 lines
qga/commands-posix.c static void build_guest_fsinfo_for_device(char const *devpath, · line 1213
Quoted 3 lines
qga/commands-posix.c +1
-0+ fs->name =g_strdup ("??\?-ENOENT" );Hmm, maybe we should make the field optional instead.
Does that harm compatibility in a meaningful way? I'm happy to do whatever QGA maintainers want me to do. I just did something quick and dirty to get it working at all as a conversation starter. O:-)
Quoted 16 lines
Quoted 9 lines
qga/commands-posix.c +3
-1+ }else { +error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); + }return ; } --Quoted 3 lines
2.34.3
--
Marc-André Lureau
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
Quoted 44 lines · John Snow
Quoted 27 lines · Marc-André Lureau
Hi
Quoted 23 lines · John Snow
In some container environments, there may be references to block devices witnessable from a container through
/proc/self/mountinfothat reference devices we simply don't have access to in the container, and could not provide information about.Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +0
-0@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath,Quoted 9 lines
qga/commands-posix.c static void build_guest_fsinfo_for_device(char const *devpath, · line 1212
Quoted 6 lines
qga/commands-posix.c +3
-1syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, etc. */ +fprintf (stderr,"realpath(%s) returned NULL/ENOENT\n" , devpath);qga uses
g_critical()(except for some win32 code paths atm)Whoops, this is a debugging thing that I left in by accident. I was just so excited that after testing overnight, everything worked. :)
Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
+
fs->name=g_strdup("??\?-ENOENT");Hmm, maybe we should make the field optional instead.
Does that harm compatibility in a meaningful way? I'm happy to do whatever QGA maintainers want me to do. I just did something quick and dirty to get it working at all as a conversation starter. O:-)
Should the device get ignored instead of returning up a dummy device? ... at least that's what I'd expect at a quick glance at the problem...
Thomas
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
In reply to Marc-André LureauQuoted 40 lines · Marc-André Lureau
Hi
Quoted 28 lines · John Snow
In some container environments, there may be references to block devices witnessable from a container through
/proc/self/mountinfothat reference devices we simply don't have access to in the container, and could not provide information about.Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +2
-1@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath, syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, Quoted 4 lines
etc. */
+ fprintf(stderr, "realpath(%s) returned NULL/ENOENT\n",
devpath);qga uses
g_critical()(except for some win32 code paths atm)
Quoted 4 lines
Quoted 2 lines
+
fs->name= yHmm, maybe we should make the field optional instead.
In my own testing, this method is called in various scenarios. Some example:
devpath==/sys/dev/block/253:0
syspath==/sys/devices/virtual/block/dm-0
=> fs->name == dm-0
devpath==/sys/devices/virtual/block/dm-0/slaves/nvme0n1p4 syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p4
=> fs->name == nvme0n1p4
devpath==/sys/dev/block/259:2 syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p2
=> fs->name == nvme0n1p2
We set fs->name from basename(syspath)
If the realpath call fails, we could use basename(devpath). That would sometimes give the correct answer, and in other types it would at least give the major:minor number, which an admin can manually correlate if desired via /proc/partitions.
If we want to be really advanced, we could just open /proc/partitions and resolve the proper name ourselves, but that's probably overkill
basename(sysfspath)
is better than g_strdup("??\?-ENOENT") IMHO
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
Quoted 75 lines · Daniel P. Berrangé
Quoted 5 lines · Marc-André Lureau
Hi
Quoted 1 line · John Snow
In some container environments, there may be references to block
devices
Quoted 1 line
Quoted 1 line
witnessable from a container through
/proc/self/mountinfothatreference
Quoted 34 lines
Quoted 26 lines
devices we simply don't have access to in the container, and could not provide information about.
Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +2
-1@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath, syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, Quoted 4 lines
etc. */
+ fprintf(stderr, "realpath(%s) returned NULL/ENOENT\n",
devpath);qga uses
g_critical()(except for some win32 code paths atm)Quoted 4 lines
Quoted 2 lines
+
fs->name= yHmm, maybe we should make the field optional instead.
In my own testing, this method is called in various scenarios. Some example:
devpath==/sys/dev/block/253:0
syspath==/sys/devices/virtual/block/dm-0=> fs->name == dm-0devpath==/sys/devices/virtual/block/dm-0/slaves/nvme0n1p4
syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p4
=> fs->name == nvme0n1p4devpath==/sys/dev/block/259:2
syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p2
=> fs->name == nvme0n1p2We set
fs->namefrom basename(syspath)If the realpath call fails, we could use basename(devpath). That would sometimes give the correct answer, and in other types it would at least give the major:minor number, which an admin can manually correlate if desired via
/proc/partitions.
Quoted 7 lines
If we want to be really advanced, we could just open
/proc/partitionsand resolve the proper name ourselves, but that's probably overkillbasename(sysfspath)
is better than
g_strdup("??\?-ENOENT")IMHO
Sure! I had something like that initially, but chickened out specifically because I thought major:minor was a nonsense kind of reply, so I opted for more egregiously obvious nonsense. I figured I'd find strong opinions that way ;)
I'm just not sure how this data is used in practice so I had no insight as to what would be best. I can use the basename, sure.
(Should I also add an optional flag field that indicates the path was not resolvable, do you think? I guess we can always add it later if needed, but not sure if i need to head that one off at the pass.)
As for Thomas' comment: I wasn't entirely clear on precisely when we'd run into this scenario and I didn't know if it was a good idea to skip the entries entirely. Maybe getting platform mount information even if we can't access it is still important when working with containers? I don't know one way or the other TBQH. I'm not very well traveled with devices, filesystems, and permissions where containers are concerned.
/shrug
Quoted 11 lines
With regards,
Daniel
--
|: https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-
https://fstop138.berrange.com :|
|: https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|
Re: [PATCH v2 03/10] qga: treat get-guest-fsinfo as "best effort"
Quoted 83 lines · John Snow
Quoted 80 lines · Daniel P. Berrangé
Quoted 5 lines · Marc-André Lureau
Hi
Quoted 1 line · John Snow
In some container environments, there may be references to block
devices
Quoted 1 line
Quoted 1 line
witnessable from a container through
/proc/self/mountinfothatreference
Quoted 34 lines
Quoted 26 lines
devices we simply don't have access to in the container, and could not provide information about.
Instead of failing the entire fsinfo command, return stub information for these failed lookups.
This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests.
Signed-off-by John Snow <[email protected]>--- qga/commands-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)qga/commands-posix.c +2
-1@@ -1207,7 +1207,13 @@ static void build_guest_fsinfo_for_device(char const *devpath, syspath =realpath (devpath,NULL );if (!syspath) { -error_setg_errno (errp, errno,"realpath(\"%s\")" , devpath); +if (errno ==ENOENT ) { +/* This devpath may not exist because of container config, Quoted 4 lines
etc. */
+ fprintf(stderr, "realpath(%s) returned NULL/ENOENT\n",
devpath);qga uses
g_critical()(except for some win32 code paths atm)Quoted 4 lines
Quoted 2 lines
+
fs->name= yHmm, maybe we should make the field optional instead.
In my own testing, this method is called in various scenarios. Some example:
devpath==/sys/dev/block/253:0
syspath==/sys/devices/virtual/block/dm-0=> fs->name == dm-0devpath==/sys/devices/virtual/block/dm-0/slaves/nvme0n1p4
syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p4
=> fs->name == nvme0n1p4devpath==/sys/dev/block/259:2
syspath==/sys/devices/pci0000:00/0000:00:1d.0/0000:02:00.0/nvme/nvme0/nvme0n1/nvme0n1p2
=> fs->name == nvme0n1p2We set
fs->namefrom basename(syspath)If the realpath call fails, we could use basename(devpath). That would sometimes give the correct answer, and in other types it would at least give the major:minor number, which an admin can manually correlate if desired via
/proc/partitions.If we want to be really advanced, we could just open
/proc/partitionsand resolve the proper name ourselves, but that's probably overkillbasename(sysfspath)
Quoted 7 lines
Quoted 2 lines
is better than
g_strdup("??\?-ENOENT")IMHOSure! I had something like that initially, but chickened out specifically because I thought major:minor was a nonsense kind of reply, so I opted for more egregiously obvious nonsense. I figured I'd find strong opinions that way ;)
It is a different format but it is semantically giving similar info.
If we want to just leave it empty though that's fine too.
Quoted 8 lines
I'm just not sure how this data is used in practice so I had no insight as to what would be best. I can use the basename, sure.
(Should I also add an optional flag field that indicates the path was not resolvable, do you think? I guess we can always add it later if needed, but not sure if i need to head that one off at the pass.)
Quoted 6 lines
As for Thomas' comment: I wasn't entirely clear on precisely when we'd run into this scenario and I didn't know if it was a good idea to skip the entries entirely. Maybe getting platform mount information even if we can't access it is still important when working with containers? I don't know one way or the other TBQH. I'm not very well traveled with devices, filesystems, and permissions where containers are concerned.
I view the primary purpose of this command to be offering a way to enumerate filesystems. Whether we report what block device the FS on host is a secondary purpose. So as long as we can fullfill the primary purpose, its sufficient IMHO.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v2 4/10 tests/vm: use 'cp' instead of 'ln' for temporary vm images
In reply to John SnowIf the initial setup fails, you've permanently altered the state of the downloaded image in an unknowable way. Use 'cp' like our other test setup scripts do.
--- tests/vm/centos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/vm/centos +1 -1
@@ -34,7 +34,7 @@ class CentosVM(basevm.BaseVM): def build_image(self, img): cimg = self._download_with_cache("https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2") img_tmp = img + ".tmp" - subprocess.check_call(["ln", "-f", cimg, img_tmp]) + subprocess.check_call(['cp', '-f', cimg, img_tmp]) self.exec_qemu_img("resize", img_tmp, "50G") self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()]) self.wait_ssh()
Signature · 1 line
2.34.3
PATCH v2 5/10 tests/vm: switch CentOS 8 to CentOS 8 Stream
In reply to John SnowThe old CentOS image didn't work anymore because it was already EOL at the beginning of 2022.
--- tests/vm/centos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/vm/centos +3 -3
@@ -1,8 +1,8 @@ #!/usr/bin/env python3 # -# CentOS image +# CentOS 8 Stream image # -# Copyright 2018 Red Hat Inc. +# Copyright 2018, 2022 Red Hat Inc. # # Authors: # Fam Zheng <[email protected]>
@@ -32,7 +32,7 @@ class CentosVM(basevm.BaseVM): """ def build_image(self, img): - cimg = self._download_with_cache("https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.3.2011-20201204.2.x86_64.qcow2") + cimg = self._download_with_cache("https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20220125.1.x86_64.qcow2") img_tmp = img + ".tmp" subprocess.check_call(['cp', '-f', cimg, img_tmp]) self.exec_qemu_img("resize", img_tmp, "50G")
Signature · 1 line
2.34.3
PATCH v2 6/10 tests/vm: switch centos.aarch64 to CentOS 8 Stream
In reply to John SnowSwitch this test over to using a cloud image like the base CentOS8 VM test, which helps make this script a bit simpler too.
Note: At time of writing, this test seems pretty flaky when run without KVM support for aarch64. Certain unit tests like migration-test, virtio-net-failover, test-hmp and qom-test seem quite prone to fail under TCG. Still, this is an improvement in that at least pure build tests are functional.
--- tests/vm/centos.aarch64 | 174 ++++++---------------------------------- 1 file changed, 24 insertions(+), 150 deletions(-)
tests/vm/centos.aarch64 +24 -150
@@ -20,150 +20,38 @@ import time import traceback import aarch64vm + DEFAULT_CONFIG = { 'cpu' : "max", 'machine' : "virt,gic-version=max", - 'install_cmds' : "yum install -y make ninja-build git python3 gcc gcc-c++ flex bison, "\ - "yum install -y glib2-devel perl pixman-devel zlib-devel, "\ - "alternatives --set python /usr/bin/python3, "\ - "sudo dnf config-manager "\ - "--add-repo=https://download.docker.com/linux/centos/docker-ce.repo,"\ - "sudo dnf install --nobest -y docker-ce.aarch64,"\ - "systemctl enable docker", + 'install_cmds' : ( + "dnf config-manager --set-enabled powertools, " + "dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo, " + "dnf install -y make ninja-build git python38 gcc gcc-c++ flex bison "\ + "glib2-devel perl pixman-devel zlib-devel docker-ce.aarch64, " + "systemctl enable docker, " + ), # We increase beyond the default time since during boot # it can take some time (many seconds) to log into the VM. 'ssh_timeout' : 60, } + class CentosAarch64VM(basevm.BaseVM): - name = "centos.aarch64" + name = "centos8.aarch64" arch = "aarch64" - login_prompt = "localhost login:" - prompt = '[root@localhost ~]#' - image_name = "CentOS-8-aarch64-1905-dvd1.iso" - image_link = "http://mirrors.usc.edu/pub/linux/distributions/centos/8.0.1905/isos/aarch64/" + image_name = "CentOS-Stream-GenericCloud-8-20220125.1.aarch64.qcow2" + image_link = "https://cloud.centos.org/centos/8-stream/aarch64/images/" image_link += image_name BUILD_SCRIPT = """ set -e; cd $(mktemp -d); - sudo chmod a+r /dev/vdb; - tar --checkpoint=.10 -xf /dev/vdb; + export SRC_ARCHIVE=/dev/vdb; + sudo chmod a+r $SRC_ARCHIVE; + tar -xf $SRC_ARCHIVE; ./configure {configure_opts}; make --output-sync {target} -j{jobs} {verbose}; """ - def set_key_perm(self): - """Set permissions properly on certain files to allow - ssh access.""" - self.console_wait_send(self.prompt, - "/usr/sbin/restorecon -R -v /root/.ssh\n") - self.console_wait_send(self.prompt, - "/usr/sbin/restorecon -R -v "\ - "/home/{}/.ssh\n".format(self._config["guest_user"])) - - def create_kickstart(self): - """Generate the kickstart file used to generate the centos image.""" - # Start with the template for the kickstart. - ks_file = self._source_path + "/tests/vm/centos-8-aarch64.ks" - subprocess.check_call("cp {} ./ks.cfg".format(ks_file), shell=True) - # Append the ssh keys to the kickstart file - # as the post processing phase of installation. - with open("ks.cfg", "a") as f: - # Add in the root pw and guest user. - rootpw = "rootpw --plaintext {}\n" - f.write(rootpw.format(self._config["root_pass"])) - add_user = "user --groups=wheel --name={} "\ - "--password={} --plaintext\n" - f.write(add_user.format(self._config["guest_user"], - self._config["guest_pass"])) - # Add the ssh keys. - f.write("%post --log=/root/ks-post.log\n") - f.write("mkdir -p /root/.ssh\n") - addkey = 'echo "{}" >> /root/.ssh/authorized_keys\n' - addkey_cmd = addkey.format(self._config["ssh_pub_key"]) - f.write(addkey_cmd) - f.write('mkdir -p /home/{}/.ssh\n'.format(self._config["guest_user"])) - addkey = 'echo "{}" >> /home/{}/.ssh/authorized_keys\n' - addkey_cmd = addkey.format(self._config["ssh_pub_key"], - self._config["guest_user"]) - f.write(addkey_cmd) - f.write("%end\n") - # Take our kickstart file and create an .iso from it. - # The .iso will be provided to qemu as we boot - # from the install dvd. - # Anaconda will recognize the label "OEMDRV" and will - # start the automated installation. - gen_iso_img = 'genisoimage -output ks.iso -volid "OEMDRV" ks.cfg' - subprocess.check_call(gen_iso_img, shell=True) - - def wait_for_shutdown(self): - """We wait for qemu to shutdown the VM and exit. - While this happens we display the console view - for easier debugging.""" - # The image creation is essentially done, - # so whether or not the wait is successful we want to - # wait for qemu to exit (the self.wait()) before we return. - try: - self.console_wait("reboot: Power down") - except Exception as e: - sys.stderr.write("Exception hit\n") - if isinstance(e, SystemExit) and e.code == 0: - return 0 - traceback.print_exc() - finally: - self.wait() - - def build_base_image(self, dest_img): - """Run through the centos installer to create - a base image with name dest_img.""" - # We create the temp image, and only rename - # to destination when we are done. - img = dest_img + ".tmp" - # Create an empty image. - # We will provide this as the install destination. - qemu_img_create = "qemu-img create {} 50G".format(img) - subprocess.check_call(qemu_img_create, shell=True) - - # Create our kickstart file to be fed to the installer. - self.create_kickstart() - # Boot the install dvd with the params as our ks.iso - os_img = self._download_with_cache(self.image_link) - dvd_iso = "centos-8-dvd.iso" - subprocess.check_call(["cp", "-f", os_img, dvd_iso]) - extra_args = "-cdrom ks.iso" - extra_args += " -drive file={},if=none,id=drive1,cache=writeback" - extra_args += " -device virtio-blk,drive=drive1,bootindex=1" - extra_args = extra_args.format(dvd_iso).split(" ") - self.boot(img, extra_args=extra_args) - self.console_wait_send("change the selection", "\n") - # We seem to need to hit esc (chr(27)) twice to abort the - # media check, which takes a long time. - # Waiting a bit seems to be more reliable before hitting esc. - self.console_wait("Checking") - time.sleep(5) - self.console_wait_send("Checking", chr(27)) - time.sleep(5) - self.console_wait_send("Checking", chr(27)) - print("Found Checking") - # Give sufficient time for the installer to create the image. - self.console_init(timeout=7200) - self.wait_for_shutdown() - os.rename(img, dest_img) - print("Done with base image build: {}".format(dest_img)) - - def check_create_base_img(self, img_base, img_dest): - """Create a base image using the installer. - We will use the base image if it exists. - This helps cut down on install time in case we - need to restart image creation, - since the base image creation can take a long time.""" - if not os.path.exists(img_base): - print("Generate new base image: {}".format(img_base)) - self.build_base_image(img_base); - else: - print("Use existing base image: {}".format(img_base)) - # Save a copy of the base image and copy it to dest. - # which we will use going forward. - subprocess.check_call(["cp", img_base, img_dest]) def boot(self, img, extra_args=None): aarch64vm.create_flash_images(self._tmpdir, self._efi_aarch64)
@@ -185,42 +73,28 @@ class CentosAarch64VM(basevm.BaseVM): super(CentosAarch64VM, self).boot(img, extra_args=extra_args) def build_image(self, img): + cimg = self._download_with_cache(self.image_link) img_tmp = img + ".tmp" - self.check_create_base_img(img + ".base", img_tmp) - - # Boot the new image for the first time to finish installation. - self.boot(img_tmp) - self.console_init() - self.console_wait_send(self.login_prompt, "root\n") - self.console_wait_send("Password:", - "{}\n".format(self._config["root_pass"])) - - self.set_key_perm() - self.console_wait_send(self.prompt, "rpm -q centos-release\n") - enable_adapter = "sed -i 's/ONBOOT=no/ONBOOT=yes/g'" \ - " /etc/sysconfig/network-scripts/ifcfg-enp0s1\n" - self.console_wait_send(self.prompt, enable_adapter) - self.console_wait_send(self.prompt, "ifup enp0s1\n") - self.console_wait_send(self.prompt, - 'echo "qemu ALL=(ALL) NOPASSWD:ALL" | '\ - 'sudo tee /etc/sudoers.d/qemu\n') - self.console_wait(self.prompt) - - # Rest of the commands we issue through ssh. + subprocess.run(['cp', '-f', cimg, img_tmp]) + self.exec_qemu_img("resize", img_tmp, "50G") + self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()]) self.wait_ssh(wait_root=True) + self.ssh_root_check("touch /etc/cloud/cloud-init.disabled") # If the user chooses *not* to do the second phase, # then we will jump right to the graceful shutdown if self._config['install_cmds'] != "": install_cmds = self._config['install_cmds'].split(',') for cmd in install_cmds: - self.ssh_root(cmd) + self.ssh_root_check(cmd) + self.ssh_root("poweroff") - self.wait_for_shutdown() + self.wait() os.rename(img_tmp, img) print("image creation complete: {}".format(img)) return 0 + if __name__ == "__main__": defaults = aarch64vm.get_config_defaults(CentosAarch64VM, DEFAULT_CONFIG) sys.exit(basevm.main(CentosAarch64VM, defaults))
Signature · 1 line
2.34.3
PATCH v2 7/10 tests/vm: update sha256sum for ubuntu.aarch64
In reply to John SnowThis checksum changes weekly; use a fixed point image and update the checksum so we don't have to re-download it quite so much.
Note: Just like the centos.aarch64 test, this test currently seems very flaky when run as a TCG test.
--- tests/vm/ubuntu.aarch64 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tests/vm/ubuntu.aarch64 +6 -2
@@ -32,9 +32,13 @@ DEFAULT_CONFIG = { class UbuntuAarch64VM(ubuntuvm.UbuntuVM): name = "ubuntu.aarch64" arch = "aarch64" + # NOTE: The Ubuntu 18.04 cloud images are updated weekly. The + # release below has been chosen as the latest at time of writing. + # Using the rolling latest release means the SHA will be wrong + # within a week. image_name = "ubuntu-18.04-server-cloudimg-arm64.img" - image_link = "https://cloud-images.ubuntu.com/releases/18.04/release/" + image_name - image_sha256="0fdcba761965735a8a903d8b88df8e47f156f48715c00508e4315c506d7d3cb1" + image_link = "https://cloud-images.ubuntu.com/releases/bionic/release-20220610/" + image_name + image_sha256="0eacc5142238788365576b15f1d0b6f23dda6d3e545ee22f5306af7bd6ec47bd" BUILD_SCRIPT = """ set -e; cd $(mktemp -d);
Signature · 1 line
2.34.3
PATCH v2 8/10 tests/vm: remove ubuntu.i386 VM test
In reply to John SnowUbuntu 18.04 is out of our support window, and Ubuntu 20.04 does not support i386 anymore. The debian project does, but they do not provide any cloud images for it, a new expect-style script would have to be written.
Since we have i386 cross-compiler tests hosted on GitLab CI, we don't need to support this VM test anymore.
--- tests/vm/Makefile.include | 3 +-- tests/vm/ubuntu.i386 | 40 --------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100755 tests/vm/ubuntu.i386
tests/vm/Makefile.include +1 -2
@@ -8,7 +8,7 @@ EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd) X86_IMAGES := freebsd netbsd openbsd centos fedora haiku.x86_64 ifneq ($(GENISOIMAGE),) -X86_IMAGES += ubuntu.i386 centos +X86_IMAGES += centos ifneq ($(EFI_AARCH64),) ARM64_IMAGES += ubuntu.aarch64 centos.aarch64 endif
@@ -39,7 +39,6 @@ vm-help vm-test: @echo " vm-build-fedora - Build QEMU in Fedora VM" ifneq ($(GENISOIMAGE),) @echo " vm-build-centos - Build QEMU in CentOS VM, with Docker" - @echo " vm-build-ubuntu.i386 - Build QEMU in ubuntu i386 VM" ifneq ($(EFI_AARCH64),) @echo " vm-build-ubuntu.aarch64 - Build QEMU in ubuntu aarch64 VM" @echo " vm-build-centos.aarch64 - Build QEMU in CentOS aarch64 VM"
tests/vm/ubuntu.i386 deleted +0 -40
@@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -# -# Ubuntu i386 image -# -# Copyright 2017 Red Hat Inc. -# -# Authors: -# Fam Zheng <[email protected]> -# -# This code is licensed under the GPL version 2 or later. See -# the COPYING file in the top-level directory. -# - -import sys -import basevm -import ubuntuvm - -DEFAULT_CONFIG = { - 'install_cmds' : "apt-get update,"\ - "apt-get build-dep -y qemu,"\ - "apt-get install -y libfdt-dev language-pack-en ninja-build", -} - -class UbuntuX86VM(ubuntuvm.UbuntuVM): - name = "ubuntu.i386" - arch = "i386" - image_link="https://cloud-images.ubuntu.com/releases/bionic/"\ - "release-20191114/ubuntu-18.04-server-cloudimg-i386.img" - image_sha256="28969840626d1ea80bb249c08eef1a4533e8904aa51a327b40f37ac4b4ff04ef" - BUILD_SCRIPT = """ - set -e; - cd $(mktemp -d); - sudo chmod a+r /dev/vdb; - tar -xf /dev/vdb; - ./configure {configure_opts}; - make --output-sync {target} -j{jobs} {verbose}; - """ - -if __name__ == "__main__": - sys.exit(basevm.main(UbuntuX86VM, DEFAULT_CONFIG))
Signature · 1 line
2.34.3
Re: [PATCH v2 08/10] tests/vm: remove ubuntu.i386 VM test
Quoted 8 lines · John Snow
Ubuntu 18.04 is out of our support window, and Ubuntu 20.04 does not support i386 anymore. The debian project does, but they do not provide any cloud images for it, a new expect-style script would have to be written.
Since we have i386 cross-compiler tests hosted on GitLab CI, we don't need to support this VM test anymore.
Quoted 6 lines
Signed-off-by John Snow <[email protected]>--- tests/vm/Makefile.include | 3 +-- tests/vm/ubuntu.i386 | 40 --------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-)delete mode 100755 tests/vm/ubuntu.i386
PATCH v2 9/10 tests/vm: remove duplicate 'centos' VM test
In reply to John SnowThis is listed twice by accident; we require genisoimage to run the test, so remove the unconditional entry.
--- tests/vm/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/vm/Makefile.include +1 -1
@@ -6,7 +6,7 @@ HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m)) EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd) -X86_IMAGES := freebsd netbsd openbsd centos fedora haiku.x86_64 +X86_IMAGES := freebsd netbsd openbsd fedora haiku.x86_64 ifneq ($(GENISOIMAGE),) X86_IMAGES += centos ifneq ($(EFI_AARCH64),)
Signature · 1 line
2.34.3
Re: [PATCH v2 09/10] tests/vm: remove duplicate 'centos' VM test
Quoted 13 lines · John Snow
This is listed twice by accident; we require genisoimage to run the test, so remove the unconditional entry.
Signed-off-by John Snow <[email protected]>--- tests/vm/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/vm/Makefile.include +0
-0
tests/vm/Makefile.include HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m)) · line 12
Quoted 8 lines
tests/vm/Makefile.include +1
-1@@ -6,7 +6,7 @@ HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m)) EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd) -X86_IMAGES := freebsd netbsd openbsd centos fedora haiku.x86_64 +X86_IMAGES := freebsd netbsd openbsd fedora haiku.x86_64 ifneq ($(GENISOIMAGE),) X86_IMAGES += centos ifneq ($(EFI_AARCH64),)
PATCH v2 10/10 tests/vm: add 512MB extra memory per core
In reply to John SnowIf you try to run a 16 or 32 threaded test, you're going to run out of memory very quickly with qom-test and a few others. Bump the memory limit to try to scale with larger-core machines.
Add this magic in early to the configuration process so that the config file, if provided, can still override it.
--- tests/vm/basevm.py | 6 ++++++ 1 file changed, 6 insertions(+)
tests/vm/basevm.py +6 -0
@@ -99,6 +99,12 @@ def __init__(self, args, config=None): self._source_path = args.source_path # Allow input config to override defaults. self._config = DEFAULT_CONFIG.copy() + + if args.jobs and args.jobs > 4: + # Add a gig per every 2 jobs over 4 + overage = (args.jobs - 4) // 2 + self._config['memory'] = f"{4 + overage}G" + if config != None: self._config.update(config) self.validate_ssh_keys()
Signature · 1 line
2.34.3
Quoted 6 lines · John Snow
This patch series attempts to improve the reliability of several of the VM test targets. In particular, both CentOS 8 tests are non-functional because CentOS 8 was EOL at the beginning of this calendar year, with repositories and mirrors going offline.
Quoted 8 lines
Notably, I also remove the ubuntu.i386 test because we no longer support Ubuntu 18.04 nor do we have explicit need of an i386 build test.
After this series, I am able to successfully run every VM target on an
x86_64host, except:- ubuntu.aarch64: Hangs often during testing, see below.
- centos.aarch64: Hangs often during testing, see below.
I've since gotten a clean run on centos.aarch64 for the first time in a long time by upping the memory allocation to be 1G per job; so my 12 thread, 6 core intel laptop used 6GB to complete this test successfully. With that not having a hard blocker on it anymore, I'll work on upgrading the ubuntu container.
Quoted 57 lines
- haiku.x86_64: Build failures not addressed by this series, see
https://lists.gnu.org/archive/html/qemu-devel/2022-06/msg02103.htmlThe unit tests that I see fail most often are:
- qom-test: ENOMEM with default config and many cores
- test-hmp: ENOMEM with default config and many cores
- virtio-net-failover: Seems to like to hang on openbsd
- migration-test: Tends to hang under aarch64 tcgIncreasing the default memory (patch 10) has seemingly helped both reliability *and* reduced race conditions quite a bit, both on my 12-thread intel laptop and on my 32-thread AMD 5950x desktop.
Due to how long it takes to run these tests, though, I can't claim perfect reliability. The flakiness of virtio-net-failover and migration-test is something that probably still needs to be addressed, but it's outside of my expertise and time budget at present to pursue it.
Future work (next version? next series?);
- Try to get centos.aarch64 working reliably under TCG
- Upgrade ubuntu.aarch64 to 20.04 after fixing centos.aarch64
- Fix the Haiku build test, if possible.
- Ensure I can reliably run and pass "make vm-build-all". (Remove VMs from this recipe if necessary.)John Snow (10):
tests/qemu-iotests: hotfix for 307, 223 output tests/qemu-iotests: skip 108 when FUSE is not loaded
qga: treat get-guest-fsinfo as "best effort" tests/vm: use 'cp' instead of 'ln' for temporary vm images tests/vm: switch CentOS 8 to CentOS 8 Stream tests/vm: switch centos.aarch64 to CentOS 8 Stream tests/vm: update sha256sum for ubuntu.aarch64 tests/vm: remove ubuntu.i386 VM test
tests/vm: remove duplicate 'centos' VM test tests/vm: add 512MB extra memory per coreqga/commands-posix.c | 8 +- tests/qemu-iotests/108 | 5 ++ tests/qemu-iotests/223.out | 4 +- tests/qemu-iotests/307.out | 4 +- tests/vm/Makefile.include | 5 +- tests/vm/basevm.py | 6 ++ tests/vm/centos | 8 +- tests/vm/centos.aarch64 | 174 +++++-------------------------------- tests/vm/ubuntu.aarch64 | 8 +- tests/vm/ubuntu.i386 | 40 --------- 10 files changed, 58 insertions(+), 204 deletions(-) delete mode 100755 tests/vm/ubuntu.i386--
2.34.3