Re: [PATCH] migration: Check current_migration in migration_is_running()
On 06/11/2024 18.18, Pierrick Bouvier wrote: On 11/6/24 01:43, Thomas Huth wrote: On 05/11/2024 19.27, Peter Xu wrote: Report shows that commit 34a8892dec broke iotest 055: https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c...@linaro.org FWIW, this patch also fixes a lot of other broken iotests (vmdk and vpc) that occur when running "make check SPEED=thorough". Tested-by: Thomas Huth Good news! I'm a bit confused by your message. I thought SPEED=slow was the most complete test setup, but is it SPEED=thorough instead? It depends... for the qtests, "slow" and "thorough" is the same, but for the iotests, we enable even more additional formats with "thorough". Thomas
Re: [PATCH] migration: Check current_migration in migration_is_running()
On 05/11/2024 19.27, Peter Xu wrote: Report shows that commit 34a8892dec broke iotest 055: https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c...@linaro.org FWIW, this patch also fixes a lot of other broken iotests (vmdk and vpc) that occur when running "make check SPEED=thorough". Tested-by: Thomas Huth
Re: [PATCH v1 07/16] test/qtest/aspeed_smc-test: Fix coding style
On 18/10/2024 07.31, Jamin Lin wrote: Fix coding style issues from checkpatch.pl Signed-off-by: Jamin Lin --- tests/qtest/aspeed_smc-test.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c index c713a3700b..4673371d95 100644 --- a/tests/qtest/aspeed_smc-test.c +++ b/tests/qtest/aspeed_smc-test.c @@ -353,7 +353,8 @@ static void test_read_page_mem(void) uint32_t page[FLASH_PAGE_SIZE / 4]; int i; -/* Enable 4BYTE mode for controller. This is should be strapped by +/* + * Enable 4BYTE mode for controller. This is should be strapped by * HW for CE0 anyhow. */ spi_ce_ctrl(1 << CRTL_EXTENDED0); @@ -394,7 +395,8 @@ static void test_write_page_mem(void) uint32_t page[FLASH_PAGE_SIZE / 4]; int i; -/* Enable 4BYTE mode for controller. This is should be strapped by +/* + * Enable 4BYTE mode for controller. This is should be strapped by * HW for CE0 anyhow. */ spi_ce_ctrl(1 << CRTL_EXTENDED0); Reviewed-by: Thomas Huth
Re: [PATCH v3 07/11] hw/sh4/r2d: Realize IDE controller before accessing it
On 13/10/2024 06.53, Guenter Roeck wrote: On 10/12/24 07:06, Bernhard Beschow wrote: Am 12. Oktober 2024 09:40:27 UTC schrieb Thomas Huth : On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote: On 11/10/24 05:23, Thomas Huth wrote: On 03/05/2024 23.34, Guenter Roeck wrote: Hi, On Thu, Feb 08, 2024 at 07:12:40PM +0100, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori Sato qemu 9.0 fails to boot Linux from ide/ata drives with the sh4 and sh4eb emulations. Error log is as follows. ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100 ata1.00: 16384 sectors, multi 16: LBA48 ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA ata1: lost interrupt (Status 0x58) [ and more similar errors ] qemu command line: qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \ -snapshot -drive file=rootfs.ext2,format=raw,if=ide \ -append "root=/dev/sda console=ttySC1,115200 noiotrap" \ -serial null -serial stdio -monitor null -nographic -no-reboot Bisect points to this patch (see below). Reverting it fixes the problem. Sorry Guenter for missing your email :( Hi Philippe! Today I noticed that our sh4 test from tests/avocado/ tuxrun_baselines.py is failing (which is not run by default, that's why nobody noticed), and bisection took me to the same result that Guenter already reported. "not run by default" because flaky. Having a quick look, the problem seems hw/ide/core.c uses non-QOM shortcuts. In particular ide_bus_init_output_irq() expects a preset IRQ. Not something trivial to fix. I wonder whether the other spots that use ide_bus_init_output_irq() or similar constructs are broken now, too. Bernhard apparently already fixed (reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf. But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ? There is an indirection going on in pmac_ide_irq() which triggers real_*_irq. These get wired via sysbus API after realize() while ide_bus_init_output_irq() wires to pmac_ide_irq(). So fc432ba0f58343c8912b80e9056315bb9bd8df92 seems safe to me (haven't tested it though). Not sure if that answers the question, but booting from ide works for both mac99 and g3beige emulations. Ok, thank you both, that sounds like we should be safe with macio IDE, indeed! Thomas
Re: [PATCH v3 07/11] hw/sh4/r2d: Realize IDE controller before accessing it
On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote: On 11/10/24 05:23, Thomas Huth wrote: On 03/05/2024 23.34, Guenter Roeck wrote: Hi, On Thu, Feb 08, 2024 at 07:12:40PM +0100, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori Sato qemu 9.0 fails to boot Linux from ide/ata drives with the sh4 and sh4eb emulations. Error log is as follows. ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100 ata1.00: 16384 sectors, multi 16: LBA48 ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA ata1: lost interrupt (Status 0x58) [ and more similar errors ] qemu command line: qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \ -snapshot -drive file=rootfs.ext2,format=raw,if=ide \ -append "root=/dev/sda console=ttySC1,115200 noiotrap" \ -serial null -serial stdio -monitor null -nographic -no-reboot Bisect points to this patch (see below). Reverting it fixes the problem. Sorry Guenter for missing your email :( Hi Philippe! Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py is failing (which is not run by default, that's why nobody noticed), and bisection took me to the same result that Guenter already reported. "not run by default" because flaky. Having a quick look, the problem seems hw/ide/core.c uses non-QOM shortcuts. In particular ide_bus_init_output_irq() expects a preset IRQ. Not something trivial to fix. I wonder whether the other spots that use ide_bus_init_output_irq() or similar constructs are broken now, too. Bernhard apparently already fixed (reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf. But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ? Thomas
Re: [PATCH v3 07/11] hw/sh4/r2d: Realize IDE controller before accessing it
On 03/05/2024 23.34, Guenter Roeck wrote: Hi, On Thu, Feb 08, 2024 at 07:12:40PM +0100, Philippe Mathieu-Daudé wrote: We should not wire IRQs on unrealized device. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Yoshinori Sato qemu 9.0 fails to boot Linux from ide/ata drives with the sh4 and sh4eb emulations. Error log is as follows. ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100 ata1.00: 16384 sectors, multi 16: LBA48 ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK2.5+ PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA ata1: lost interrupt (Status 0x58) [ and more similar errors ] qemu command line: qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \ -snapshot -drive file=rootfs.ext2,format=raw,if=ide \ -append "root=/dev/sda console=ttySC1,115200 noiotrap" \ -serial null -serial stdio -monitor null -nographic -no-reboot Bisect points to this patch (see below). Reverting it fixes the problem. Hi Philippe! Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py is failing (which is not run by default, that's why nobody noticed), and bisection took me to the same result that Guenter already reported. So unless you have a clue how to fix it in a better way, I think we should revert this patch? Thomas
Re: [PATCH] block-backend: Remove deadcode
har *id, Error **errp); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque); -void blk_activate(BlockBackend *blk, Error **errp); - int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags); void blk_aio_cancel(BlockAIOCB *acb); int blk_commit_all(void); @@ -91,9 +87,6 @@ bool blk_is_sg(BlockBackend *blk); void blk_set_enable_write_cache(BlockBackend *blk, bool wce); int blk_get_flags(BlockBackend *blk); bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp); -void blk_op_unblock(BlockBackend *blk, BlockOpType op, Error *reason); -void blk_op_block_all(BlockBackend *blk, Error *reason); -void blk_op_unblock_all(BlockBackend *blk, Error *reason); int blk_set_aio_context(BlockBackend *blk, AioContext *new_context, Error **errp); void blk_add_aio_context_notifier(BlockBackend *blk, @@ -105,7 +98,6 @@ void blk_remove_aio_context_notifier(BlockBackend *blk, void (*detach_aio_context)(void *), void *opaque); void blk_add_remove_bs_notifier(BlockBackend *blk, Notifier *notify); -void blk_add_insert_bs_notifier(BlockBackend *blk, Notifier *notify); BlockBackendRootState *blk_get_root_state(BlockBackend *blk); void blk_update_root_state(BlockBackend *blk); bool blk_get_detect_zeroes_from_root_state(BlockBackend *blk); Reviewed-by: Thomas Huth
[PATCH v3] docs: Mark "gluster" support in QEMU as deprecated
According to https://marc.info/?l=fedora-devel-list&m=171934833215726 the GlusterFS development effectively ended. Thus mark it as deprecated in QEMU, so we can remove it in a future release if the project does not gain momentum again. Acked-by: Niels de Vos Acked-by: Markus Armbruster Signed-off-by: Thomas Huth --- v3: Some rewordings according to Markus' and Daniel's suggestions docs/about/deprecated.rst | 9 + qapi/block-core.json | 8 +++- block/gluster.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index c0aa52def5..c41e55f710 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -414,6 +414,15 @@ Specifying the iSCSI password in plain text on the command line using the used instead, to refer to a ``--object secret...`` instance that provides a password via a file, or encrypted. +``gluster`` backend (since 9.2) +^^^ + +According to https://marc.info/?l=fedora-devel-list&m=171934833215726 +the GlusterFS development effectively ended. Unless the development +gains momentum again, the QEMU project will remove the gluster backend +in a future release. + + Character device options '''''''''''''''''''''''' diff --git a/qapi/block-core.json b/qapi/block-core.json index c3b0a2376b..8181abef54 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3192,12 +3192,18 @@ # # @snapshot-access: Since 7.0 # +# Features: +# +# @deprecated: Member @gluster is deprecated because GlusterFS +# development ceased. +# # Since: 2.9 ## { 'enum': 'BlockdevDriver', 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs', 'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg', -'file', 'snapshot-access', 'ftp', 'ftps', 'gluster', +'file', 'snapshot-access', 'ftp', 'ftps', +{'name': 'gluster', 'features': [ 'deprecated' ] }, {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, 'http', 'https', diff --git a/block/gluster.c b/block/gluster.c index f8b415f381..f03d05251e 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -809,6 +809,8 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, goto out; } +warn_report_once("'gluster' is deprecated"); + filename = qemu_opt_get(opts, GLUSTER_OPT_FILENAME); s->debug = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG, -- 2.46.1
Re: [PATCH v2] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4
On 26/09/2024 12.24, Michael Tokarev wrote: 25.09.2024 10:24, Thomas Huth wrote: Commit 0ea0538fae516f9b4 removed the default machine of the sh4 binaries, so a lot of iotests are failing now without such a default machine. Teach the iotest harness to use the "r2d" machine instead to fix this problem. Signed-off-by: Thomas Huth --- v2: "r2d" only works on little endian, so don't try to use it for sh4eb Hm. The v1 of this patch (with sh4eb addition) has already been merged to master. I did a single pull request during my vacation (a week ago), and it contained a very fresh patch which received further discussion after I picked it up, but I haven't noticed. So we should now remove the already added sh4eb from there, it looks like.. :( I'll submit a patch doing that later today, hopefully. I'm planning to provide a patch to remove sh4eb-softmmu completely (since it is useless nowadays) ... I can add it there, too. Thomas
[PATCH v2] docs: Mark "gluster" support in QEMU as deprecated
According to https://marc.info/?l=fedora-devel-list&m=171934833215726 the GlusterFS development effectively ended. Thus mark it as deprecated in QEMU, so we can remove it in a future release if the project does not gain momentum again. Acked-by: Niels de Vos Signed-off-by: Thomas Huth --- v2: Mark it as deprecated in the QAPI and print a warning once, too docs/about/deprecated.rst | 9 + qapi/block-core.json | 7 ++- block/gluster.c | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ed31d4b0b2..b231aa3948 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command line using the used instead, to refer to a ``--object secret...`` instance that provides a password via a file, or encrypted. +``gluster`` backend (since 9.2) +^^^ + +According to https://marc.info/?l=fedora-devel-list&m=171934833215726 +the GlusterFS development effectively ended. Unless the development +gains momentum again, the QEMU project might remove the gluster backend +in a future release. + + Character device options '''''''''''''''''''''''' diff --git a/qapi/block-core.json b/qapi/block-core.json index 9f6dd59298..cb7cb1c0ed 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3187,12 +3187,17 @@ # # @snapshot-access: Since 7.0 # +# Features: +# +# @deprecated: Member @gluster is deprecated since GlusterFS ceased development +# # Since: 2.9 ## { 'enum': 'BlockdevDriver', 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs', 'cloop', 'compress', 'copy-before-write', 'copy-on-read', 'dmg', -'file', 'snapshot-access', 'ftp', 'ftps', 'gluster', +'file', 'snapshot-access', 'ftp', 'ftps', +{'name': 'gluster', 'features': [ 'deprecated' ] }, {'name': 'host_cdrom', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, {'name': 'host_device', 'if': 'HAVE_HOST_BLOCK_DEVICE' }, 'http', 'https', diff --git a/block/gluster.c b/block/gluster.c index f8b415f381..f03d05251e 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -809,6 +809,8 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, goto out; } +warn_report_once("'gluster' is deprecated"); + filename = qemu_opt_get(opts, GLUSTER_OPT_FILENAME); s->debug = qemu_opt_get_number(opts, GLUSTER_OPT_DEBUG, -- 2.46.0
[PATCH v2] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4
Commit 0ea0538fae516f9b4 removed the default machine of the sh4 binaries, so a lot of iotests are failing now without such a default machine. Teach the iotest harness to use the "r2d" machine instead to fix this problem. Signed-off-by: Thomas Huth --- v2: "r2d" only works on little endian, so don't try to use it for sh4eb tests/qemu-iotests/testenv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 0b32eec119..8cd620c202 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -244,6 +244,7 @@ def __init__(self, source_dir: str, build_dir: str, ('riscv32', 'virt'), ('riscv64', 'virt'), ('rx', 'gdbsim-r5f562n8'), +('sh4', 'r2d'), ('tricore', 'tricore_testboard') ) for suffix, machine in machine_map: -- 2.46.0
Re: [PATCH] docs: Mark "gluster" support in QEMU as deprecated
On 24/09/2024 16.12, Peter Krempa wrote: On Tue, Sep 24, 2024 at 15:24:51 +0200, Thomas Huth wrote: According to https://marc.info/?l=fedora-devel-list&m=171934833215726 the GlusterFS development effectively ended. Thus mark it as deprecated in QEMU, so we can remove it in a future release if the project does not gain momentum again. Signed-off-by: Thomas Huth --- docs/about/deprecated.rst | 9 + 1 file changed, 9 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ed31d4b0b2..b231aa3948 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command line using the used instead, to refer to a ``--object secret...`` instance that provides a password via a file, or encrypted. +``gluster`` backend (since 9.2) +^^^ + +According to https://marc.info/?l=fedora-devel-list&m=171934833215726 +the GlusterFS development effectively ended. Unless the development +gains momentum again, the QEMU project might remove the gluster backend +in a future release. Shouldn't also the 'gluster' enum entry of 'BlockdevDriver' (qapi/block-core.json) be marked as deprecated? Thanks, that's a good idea! I'll send a v2... Thomas
[PATCH] docs: Mark "gluster" support in QEMU as deprecated
According to https://marc.info/?l=fedora-devel-list&m=171934833215726 the GlusterFS development effectively ended. Thus mark it as deprecated in QEMU, so we can remove it in a future release if the project does not gain momentum again. Signed-off-by: Thomas Huth --- docs/about/deprecated.rst | 9 + 1 file changed, 9 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index ed31d4b0b2..b231aa3948 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command line using the used instead, to refer to a ``--object secret...`` instance that provides a password via a file, or encrypted. +``gluster`` backend (since 9.2) +^^^ + +According to https://marc.info/?l=fedora-devel-list&m=171934833215726 +the GlusterFS development effectively ended. Unless the development +gains momentum again, the QEMU project might remove the gluster backend +in a future release. + + Character device options '''''''''''''''''''''''' -- 2.46.0
Re: [PATCH v3 30/34] migration: remove return after g_assert_not_reached()
On 19/09/2024 06.46, Pierrick Bouvier wrote: This patch is part of a series that moves towards a consistent use of g_assert_not_reached() rather than an ad hoc mix of different assertion mechanisms. Signed-off-by: Pierrick Bouvier --- migration/dirtyrate.c| 1 - migration/postcopy-ram.c | 7 --- migration/ram.c | 2 -- 3 files changed, 10 deletions(-) Reviewed-by: Thomas Huth
Re: [PATCH for-9.1 6/9] block/nbd: Use URI parsing code from glib
On 23/09/2024 18.03, Eric Blake wrote: On Sun, Sep 22, 2024 at 08:51:22PM GMT, Richard W.M. Jones wrote: On Thu, Mar 28, 2024 at 02:13:42PM +, Richard W.M. Jones wrote: On Thu, Mar 28, 2024 at 03:06:03PM +0100, Thomas Huth wrote: Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too. -p = uri->path ? uri->path : ""; +p = g_uri_get_path(uri) ?: ""; if (p[0] == '/') { p++; } Looks ok, Reviewed-by: Richard W.M. Jones Or maybe not. This caused a regression in the nbdkit test suite (when we use qemu-img from 9.1). It seems the exportname part of the NBD URI gets munged: https://gitlab.com/qemu-project/qemu/-/issues/2584 To be more specific, it looks like g_uri_get_path("./name//with//..//slashes") is getting munged to "name/slashes". That is, glib is blindly assuming that ./ and XXX/../ can be dropped, and // can be simplified to /, which may be true for arbitrary file names but not true for abitrary URIs (since URIs have application-specific semantics, which may not match path name traversal semantics). Looks like we need to report a bug to glib, and/or see if glib's URI functions have a flag for turning off this unwanted munging. Or we may just want to document this corner case change as intentional. Ok ... so how bad is this for NBD? Can we go along with the odditiy or is this breaking some real world NBD scenarios? ... in the worst case, we have to revert the patch ... Thomas
Re: [PATCH] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4/sh4eb
On 20/09/2024 10.06, Yoshinori Sato wrote: On Wed, 18 Sep 2024 04:43:50 +0900, Thomas Huth wrote: Commit 0ea0538fae516f9b4 removed the default machine of the sh4 binaries, so a lot of iotests are failing now without such a default machine. Teach the iotest harness to use the "r2d" machine instead to fix this problem. Signed-off-by: Thomas Huth --- tests/qemu-iotests/testenv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 0b32eec119..6326e46b7b 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -244,6 +244,8 @@ def __init__(self, source_dir: str, build_dir: str, ('riscv32', 'virt'), ('riscv64', 'virt'), ('rx', 'gdbsim-r5f562n8'), +('sh4', 'r2d'), +('sh4eb', 'r2d'), ('tricore', 'tricore_testboard') ) for suffix, machine in machine_map: -- 2.46.0 r2d is works only sh4 little endian mode. Oh, that's interesting - since there is no other machine left for sh4/sh4eb. There was probably no other hardware that ran in big endian. There used to be the "shix" machine, but it got removed, I assume that one worked in big endian mode, too? Anyway, if the r2d machine only works in little endian mode, and there is apparently no other machine available anymore, I think we can disable the sh4eb target completely since it is of no use now? Or is there a reason to still keep it around? Thomas
[PATCH] tests/qemu-iotests/testenv: Use the "r2d" machine for sh4/sh4eb
Commit 0ea0538fae516f9b4 removed the default machine of the sh4 binaries, so a lot of iotests are failing now without such a default machine. Teach the iotest harness to use the "r2d" machine instead to fix this problem. Signed-off-by: Thomas Huth --- tests/qemu-iotests/testenv.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 0b32eec119..6326e46b7b 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -244,6 +244,8 @@ def __init__(self, source_dir: str, build_dir: str, ('riscv32', 'virt'), ('riscv64', 'virt'), ('rx', 'gdbsim-r5f562n8'), +('sh4', 'r2d'), +('sh4eb', 'r2d'), ('tricore', 'tricore_testboard') ) for suffix, machine in machine_map: -- 2.46.0
[PATCH] tests/qemu-iotests/testenv: Use the "virt" machine for or1k
When compiling QEMU just with "--target-list=or1k-softmmu", there are 8 iotests failing that try to use PCI devices - but the default or1k machine does not have a PCI bus. The "virt" machine is better suited for running the iotests than the or1k default machine since it provides PCI and thus e.g. support for virtio-blk and virtio-scsi, too. With this change, there are no failing iotests anymore when using the qemu-system-or1k binary for running the tests. Signed-off-by: Thomas Huth --- tests/qemu-iotests/testenv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index c8848f2ec2..0b32eec119 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -240,6 +240,7 @@ def __init__(self, source_dir: str, build_dir: str, ('aarch64', 'virt'), ('avr', 'mega2560'), ('m68k', 'virt'), +('or1k', 'virt'), ('riscv32', 'virt'), ('riscv64', 'virt'), ('rx', 'gdbsim-r5f562n8'), -- 2.46.0
Re: [PATCH 01/39] docs/spin: replace assert(0) with g_assert_not_reached()
On 11/09/2024 14.51, Richard W.M. Jones wrote: On Wed, Sep 11, 2024 at 02:46:18PM +0200, Maciej S. Szmigiero wrote: On 11.09.2024 14:37, Eric Blake wrote: On Wed, Sep 11, 2024 at 07:33:59AM GMT, Eric Blake wrote: On Tue, Sep 10, 2024 at 03:15:28PM GMT, Pierrick Bouvier wrote: Signed-off-by: Pierrick Bouvier --- A general suggestion for the entire series: please use a commit message that explains why this is a good idea. Even something as boiler-plate as "refer to commit XXX for rationale" that can be copy-pasted into all the other commits is better than nothing, although a self-contained message is best. Maybe: This patch is part of a series that moves towards a consistent use of g_assert_not_reached() rather than an ad hoc mix of different assertion mechanisms. Or summarize your cover letter: Use of assert(false) can trip spurious control flow warnings from some versions of gcc: https://lore.kernel.org/qemu-devel/54bb02a6-1b12-460a-97f6-3f478ef76...@linaro.org/ Solve that by unifying the code base on g_assert_not_reached() instead. If using g_assert_not_reached() instead of assert(false) silences the warning about missing return value in such impossible to reach locations should we also be deleting the now-unnecessary "return" statements after g_assert_not_reached()? Although it's unlikely to be used on any compiler that can also compile qemu, there is a third implementation of g_assert_not_reached that does nothing, see: https://gitlab.gnome.org/GNOME/glib/-/blob/927683ebd94eb66c0d7868b77863f57ce9c5bc76/glib/gtestutils.h#L269 That's only in the #ifdef G_DISABLE_ASSERT case ... and we forbid that in QEMU, see osdep.h: #ifdef G_DISABLE_ASSERT #error building with G_DISABLE_ASSERT is not supported #endif So in QEMU, g_assert_not_reached() should always abort. Thomas
Re: [PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()
On 11/09/2024 00.15, Pierrick Bouvier wrote: Signed-off-by: Pierrick Bouvier --- tests/qtest/ipmi-bt-test.c | 2 +- tests/qtest/ipmi-kcs-test.c | 4 ++-- tests/qtest/rtl8139-test.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c index 383239bcd48..13f7c841f59 100644 --- a/tests/qtest/ipmi-bt-test.c +++ b/tests/qtest/ipmi-bt-test.c @@ -251,7 +251,7 @@ static void emu_msg_handler(void) msg[msg_len++] = 0xa0; write_emu_msg(msg, msg_len); } else { -g_assert(0); +g_assert_not_reached(); } } diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c index afc24dd3e46..3186c6ad64b 100644 --- a/tests/qtest/ipmi-kcs-test.c +++ b/tests/qtest/ipmi-kcs-test.c @@ -145,7 +145,7 @@ static void kcs_cmd(uint8_t *cmd, unsigned int cmd_len, break; default: -g_assert(0); +g_assert_not_reached(); } *rsp_len = j; } @@ -184,7 +184,7 @@ static void kcs_abort(uint8_t *cmd, unsigned int cmd_len, break; default: -g_assert(0); +g_assert_not_reached(); } /* Start the abort here */ diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c index eedf90f65af..55f671f2f59 100644 --- a/tests/qtest/rtl8139-test.c +++ b/tests/qtest/rtl8139-test.c @@ -65,7 +65,7 @@ PORT(IntrMask, w, 0x3c) PORT(IntrStatus, w, 0x3E) PORT(TimerInt, l, 0x54) -#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert(0); } while (0) +#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert_not_reached(); } while (0) static void test_timer(void) { Reviewed-by: Thomas Huth
Re: [PATCH 14/39] include/hw/s390x: replace assert(false) with g_assert_not_reached()
On 11/09/2024 00.15, Pierrick Bouvier wrote: Signed-off-by: Pierrick Bouvier --- include/hw/s390x/cpu-topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/s390x/cpu-topology.h b/include/hw/s390x/cpu-topology.h index c064f427e94..dcb25956a64 100644 --- a/include/hw/s390x/cpu-topology.h +++ b/include/hw/s390x/cpu-topology.h @@ -57,7 +57,7 @@ static inline void s390_topology_setup_cpu(MachineState *ms, static inline void s390_topology_reset(void) { /* Unreachable, CPU topology not implemented for TCG */ -assert(false); +g_assert_not_reached(); } #endif Reviewed-by: Thomas Huth
[PATCH] tests/qtest/hd-geo-test: Check for availability of "pc" machine before using it
In case QEMU has been configured with "--without-default-devices", the "pc" machine type might be missing in the binary. We should check for its availability before using it. Signed-off-by: Thomas Huth --- tests/qtest/hd-geo-test.c | 71 +-- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index d08bffad91..85eb8d7668 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -1074,17 +1074,26 @@ int main(int argc, char **argv) } } -qtest_add_func("hd-geo/ide/none", test_ide_none); -qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank); -qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba); -qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs); -qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0); -qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank); -qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba); -qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs); -qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs); -qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chst); -if (have_qemu_img()) { +if (qtest_has_machine("pc")) { +qtest_add_func("hd-geo/ide/none", test_ide_none); +qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank); +qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba); +qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs); +qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0); +qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank); +qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba); +qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs); +qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs); +qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chst); +} + +if (!have_qemu_img()) { +g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " + "skipping hd-geo/override/* tests"); +goto test_add_done; +} + +if (qtest_has_machine("pc")) { qtest_add_func("hd-geo/override/ide", test_override_ide); if (qtest_has_device("lsi53c895a")) { qtest_add_func("hd-geo/override/scsi", test_override_scsi); @@ -1104,30 +1113,26 @@ int main(int argc, char **argv) qtest_add_func("hd-geo/override/virtio_blk", test_override_virtio_blk); } +} -if (qtest_has_machine("q35")) { -qtest_add_func("hd-geo/override/sata", test_override_sata); -qtest_add_func("hd-geo/override/zero_chs_q35", - test_override_zero_chs_q35); -if (qtest_has_device("lsi53c895a")) { -qtest_add_func("hd-geo/override/scsi_q35", - test_override_scsi_q35); -} -if (qtest_has_device("virtio-scsi-pci")) { -qtest_add_func("hd-geo/override/scsi_hot_unplug_q35", - test_override_scsi_hot_unplug_q35); -} -if (qtest_has_device("virtio-blk-pci")) { -qtest_add_func("hd-geo/override/virtio_hot_unplug_q35", - test_override_virtio_hot_unplug_q35); -qtest_add_func("hd-geo/override/virtio_blk_q35", - test_override_virtio_blk_q35); -} - +if (qtest_has_machine("q35")) { +qtest_add_func("hd-geo/override/sata", test_override_sata); +qtest_add_func("hd-geo/override/zero_chs_q35", + test_override_zero_chs_q35); +if (qtest_has_device("lsi53c895a")) { +qtest_add_func("hd-geo/override/scsi_q35", + test_override_scsi_q35); +} +if (qtest_has_device("virtio-scsi-pci")) { +qtest_add_func("hd-geo/override/scsi_hot_unplug_q35", + test_override_scsi_hot_unplug_q35); +} +if (qtest_has_device("virtio-blk-pci")) { +qtest_add_func("hd-geo/override/virtio_hot_unplug_q35", + test_override_virtio_hot_unplug_q35); +qtest_add_func("hd-geo/override/virtio_blk_q35", + test_override_virtio_blk_q35); } -} else { -g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " - "skipping hd-geo/override/* tests"); } test_add_done: -- 2.46.0
[PATCH] tests/qtest/cdrom-test: Improve the machine detection in the cdrom test
When configuring QEMU with the --without-default-devices switch, these tests are currently failing since they assume that the "pc" and "q35" machines are always available. Add some proper checks to make the test work without these machines, too. Signed-off-by: Thomas Huth --- tests/qtest/cdrom-test.c | 77 ++-- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index 5d89e62515..9d72b24e4b 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -135,13 +135,35 @@ static void add_x86_tests(void) return; } -qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot); -if (qtest_has_device("virtio-scsi-ccw")) { -qtest_add_data_func("cdrom/boot/virtio-scsi", -"-device virtio-scsi -device scsi-cd,drive=cdr " -"-blockdev file,node-name=cdr,filename=", -test_cdboot); +if (qtest_has_machine("pc")) { +qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot); +if (qtest_has_device("virtio-scsi-ccw")) { +qtest_add_data_func("cdrom/boot/virtio-scsi", +"-device virtio-scsi -device scsi-cd,drive=cdr " +"-blockdev file,node-name=cdr,filename=", +test_cdboot); +} + +if (qtest_has_device("am53c974")) { +qtest_add_data_func("cdrom/boot/am53c974", +"-device am53c974 -device scsi-cd,drive=cd1 " +"-drive if=none,id=cd1,format=raw,file=", +test_cdboot); +} +if (qtest_has_device("dc390")) { +qtest_add_data_func("cdrom/boot/dc390", +"-device dc390 -device scsi-cd,drive=cd1 " +"-blockdev file,node-name=cd1,filename=", +test_cdboot); +} +if (qtest_has_device("lsi53c895a")) { +qtest_add_data_func("cdrom/boot/lsi53c895a", +"-device lsi53c895a -device scsi-cd,drive=cd1 " +"-blockdev file,node-name=cd1,filename=", +test_cdboot); +} } + /* * Unstable CI test under load * See https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg05509.html @@ -150,35 +172,20 @@ static void add_x86_tests(void) qtest_add_data_func("cdrom/boot/isapc", "-M isapc " "-drive if=ide,media=cdrom,file=", test_cdboot); } -if (qtest_has_device("am53c974")) { -qtest_add_data_func("cdrom/boot/am53c974", -"-device am53c974 -device scsi-cd,drive=cd1 " -"-drive if=none,id=cd1,format=raw,file=", -test_cdboot); -} -if (qtest_has_device("dc390")) { -qtest_add_data_func("cdrom/boot/dc390", -"-device dc390 -device scsi-cd,drive=cd1 " -"-blockdev file,node-name=cd1,filename=", -test_cdboot); -} -if (qtest_has_device("lsi53c895a")) { -qtest_add_data_func("cdrom/boot/lsi53c895a", -"-device lsi53c895a -device scsi-cd,drive=cd1 " -"-blockdev file,node-name=cd1,filename=", -test_cdboot); -} -if (qtest_has_device("megasas")) { -qtest_add_data_func("cdrom/boot/megasas", "-M q35 " -"-device megasas -device scsi-cd,drive=cd1 " -"-blockdev file,node-name=cd1,filename=", -test_cdboot); -} -if (qtest_has_device("megasas-gen2")) { -qtest_add_data_func("cdrom/boot/megasas-gen2", "-M q35 " -"-device megasas-gen2 -device scsi-cd,drive=cd1 " -"-blockdev file,node-name=cd1,filename=", -test_cdboot); + +if (qtest_has_machine("q35")) { +if (qtest_has_device("megasas")) { +qtest_add_data_func("cdrom/boot/megasas", "-M q35 " +"-device megasas -device scsi-cd,drive=cd1 " +"-blockdev file,node-name=cd1,filename=", +test_cdboot); +} +if (qtest_has_device("megasas-gen2")) { +qtest_add_data_func("cdrom/boot/megasas-gen2", "-M q35 " +"-device megasas-gen2 -device scsi-cd,drive=cd1 " +"-blockdev file,node-name=cd1,filename=", +test_cdboot); +} } } -- 2.46.0
Re: [PATCH] iotests: fix expected output from gnutls in NBD test
On 29/08/2024 13.02, Daniel P. Berrangé wrote: Error reporting from gnutls was improved by: commit 57941c9c86357a6a642f9ee3279d881df4043b6d Author: Daniel P. Berrangé Date: Fri Mar 15 14:07:58 2024 + crypto: push error reporting into TLS session I/O APIs This has the effect of changing the output from one of the NBD tests. Reported-by: Thomas Huth Signed-off-by: Daniel P. Berrangé --- NB, wrt qemu-stable this will be for the 9.1 stable branch once that is created, no earlier releases will need this. tests/qemu-iotests/233.out | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) Thanks, that fixes the issue, indeed. Tested-by: Thomas Huth
Re: [PULL 10/11] crypto: push error reporting into TLS session I/O APIs
On 27/08/2024 09.05, Markus Armbruster wrote: Daniel P. Berrangé writes: On Mon, Aug 12, 2024 at 05:38:41PM +0200, Thomas Huth wrote: On 24/07/2024 11.47, Daniel P. Berrangé wrote: The current TLS session I/O APIs just return a synthetic errno value on error, which has been translated from a gnutls error value. This looses a large amount of valuable information that distinguishes different scenarios. Pushing population of the "Error *errp" object into the TLS session I/O APIs gives more detailed error information. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé --- Hi Daniel! iotest 233 is failing for me with -raw now, and bisection points to this commit. Output is: --- .../qemu/tests/qemu-iotests/233.out +++ /tmp/qemu/tests/qemu-iotests/scratch/raw-file-233/233.out.bad @@ -69,8 +69,8 @@ 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == check TLS with authorization == -qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: Software caused connection abort -qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: Software caused connection abort +qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: The TLS connection was non-properly terminated. +qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: The TLS connection was non-properly terminated. This is an expected change. Previously squashed the real GNUTLS error into ECONNABORTED: -case GNUTLS_E_PREMATURE_TERMINATION: -errno = ECONNABORTED; -break; now we report the original gnutls root cause. IOW, we need to update the expected output files. Has this been done? No, I think the problem still persists. Thomas
Re: [PATCH v4 7/7] tests/qtest: Delete previous boot file
On 26/08/2024 17.26, Peter Xu wrote: On Fri, Aug 23, 2024 at 03:13:12PM +0900, Akihiko Odaki wrote: A test run may create boot files several times. Delete the previous boot file before creating a new one. Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin Acked-by: Thomas Huth I didn't track which came early, but I think Fabiano has queued the other one here: https://lore.kernel.org/r/20240820144912.320744-2-peter.mayd...@linaro.org https://gitlab.com/farosas/qemu/-/commits/migration-staging/ So we should be good. Ooops, sorry, I think I might have jumped the gun and put this patch here in my final PR for 9.1 ... I hope it's ok to do modifications on top of that later if it is still necessary. Thomas
Re: [PATCH] meson: add 'qemuutil' dependency for block.c
On 14/08/2024 12.00, Fiona Ebner wrote: The macro block_module_load() used by block.c is a wrapper around module_load(), which is implemented in util/module.c. Fixes linking for a future binary or downstream binary that does not depend on 'qemuutil' directly, but does depend on 'block'. Signed-off-by: Fiona Ebner --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 81ecd4bae7..efa0ac8d0b 100644 --- a/meson.build +++ b/meson.build @@ -3555,7 +3555,7 @@ if have_block 'blockjob.c', 'job.c', 'qemu-io-cmds.c', - )) + ), qemuutil) if config_host_data.get('CONFIG_REPLICATION') block_ss.add(files('replication.c')) endif Reviewed-by: Thomas Huth ... and CC:-ing the block maintainers, hoping that they can have a look, too, and finally pick up this patch.
Re: [PULL 10/11] crypto: push error reporting into TLS session I/O APIs
On 24/07/2024 11.47, Daniel P. Berrangé wrote: The current TLS session I/O APIs just return a synthetic errno value on error, which has been translated from a gnutls error value. This looses a large amount of valuable information that distinguishes different scenarios. Pushing population of the "Error *errp" object into the TLS session I/O APIs gives more detailed error information. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé --- Hi Daniel! iotest 233 is failing for me with -raw now, and bisection points to this commit. Output is: --- .../qemu/tests/qemu-iotests/233.out +++ /tmp/qemu/tests/qemu-iotests/scratch/raw-file-233/233.out.bad @@ -69,8 +69,8 @@ 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == check TLS with authorization == -qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: Software caused connection abort -qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: Software caused connection abort +qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: The TLS connection was non-properly terminated. +qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Failed to read option reply: Cannot read from TLS channel: The TLS connection was non-properly terminated. == check TLS fail over UNIX with no hostname == qemu-img: Could not open 'driver=nbd,path=SOCK_DIR/qemu-nbd.sock,tls-creds=tls0': No hostname for certificate validation @@ -103,14 +103,14 @@ qemu-nbd: TLS handshake failed: The TLS connection was non-properly terminated. == final server log == -qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: Software caused connection abort -qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: Software caused connection abort +qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: The TLS connection was non-properly terminated. +qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: The TLS connection was non-properly terminated. qemu-nbd: option negotiation failed: Verify failed: No certificate was found. qemu-nbd: option negotiation failed: Verify failed: No certificate was found. qemu-nbd: option negotiation failed: TLS x509 authz check for DISTINGUISHED-NAME is denied qemu-nbd: option negotiation failed: TLS x509 authz check for DISTINGUISHED-NAME is denied -qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: Software caused connection abort -qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: Software caused connection abort +qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: The TLS connection was non-properly terminated. +qemu-nbd: option negotiation failed: Failed to read opts magic: Cannot read from TLS channel: The TLS connection was non-properly terminated. qemu-nbd: option negotiation failed: TLS handshake failed: An illegal parameter has been received. qemu-nbd: option negotiation failed: TLS handshake failed: An illegal parameter has been received. *** done Could you please have a look? Thanks, Thomas diff --git a/crypto/tlssession.c b/crypto/tlssession.c index 1e98f44e0d..926f19c115 100644 --- a/crypto/tlssession.c +++ b/crypto/tlssession.c @@ -441,23 +441,20 @@ qcrypto_tls_session_set_callbacks(QCryptoTLSSession *session, ssize_t qcrypto_tls_session_write(QCryptoTLSSession *session, const char *buf, - size_t len) + size_t len, + Error **errp) { ssize_t ret = gnutls_record_send(session->handle, buf, len); if (ret < 0) { -switch (ret) { -case GNUTLS_E_AGAIN: -errno = EAGAIN; -break; -case GNUTLS_E_INTERRUPTED: -errno = EINTR; -break; -default: -errno = EIO; -break; +if (ret == GNUTLS_E_AGAIN) { +return QCRYPTO_TLS_SESSION_ERR_BLOCK; +} else { +error_setg(errp, + "Cannot write to TLS channel: %s", + gnutls_strerror(ret)); +return -1; } -ret = -1; } return ret; @@ -467,26 +464,24 @@ qcrypto_tls_session_write(QCryptoTLSSession *session, ssize_t qcrypto_tls_session_read(QCryptoTLSSession *session, char *buf, - size_t len) + size_t len, + bool gracefulTermination, + Error **errp)
Re: [PATCH 09/18] qapi/machine: Rename CpuS390* to S390Cpu, and drop 'prefix'
On 30/07/2024 10.10, Markus Armbruster wrote: QAPI's 'prefix' feature can make the connection between enumeration type and its constants less than obvious. It's best used with restraint. CpuS390Entitlement has a 'prefix' to change the generated enumeration constants' prefix from CPU_S390_POLARIZATION to S390_CPU_POLARIZATION. Rename the type to S390CpuEntitlement, so that 'prefix' is not needed. Likewise change CpuS390Polarization to S390CpuPolarization, and CpuS390State to S390CpuState. Signed-off-by: Markus Armbruster --- Acked-by: Thomas Huth
Re: [PATCH 02/18] tests/qapi-schema: Drop temporary 'prefix'
On 30/07/2024 10.10, Markus Armbruster wrote: Recent commit "qapi: Smarter camel_to_upper() to reduce need for 'prefix'" added a temporary 'prefix' to delay changing the generated code. Revert it. This changes TestUnionEnumA's generated enumeration constant prefix from TEST_UNION_ENUMA to TEST_UNION_ENUM_A. Signed-off-by: Markus Armbruster --- tests/unit/test-qobject-input-visitor.c | 4 ++-- tests/unit/test-qobject-output-visitor.c | 4 ++-- tests/qapi-schema/qapi-schema-test.json | 1 - tests/qapi-schema/qapi-schema-test.out | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) Reviewed-by: Thomas Huth
Re: [PULL 06/27] iotests/{024, 271}: add testcases for qemu-img rebase
On 31/10/2023 19.58, Kevin Wolf wrote: From: Andrey Drobyshev As the previous commit changes the logic of "qemu-img rebase" (it's using write alignment now), let's add a couple more test cases which would ensure it works correctly. In particular, the following scenarios: 024: add test case for rebase within one backing chain when the overlay cluster size > backings cluster size; 271: add test case for rebase images that contain subclusters. Check that no extra allocations are being made. Signed-off-by: Andrey Drobyshev Reviewed-by: Hanna Czenczek Message-ID: <20230919165804.439110-7-andrey.drobys...@virtuozzo.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/qemu-iotests/024 | 60 ++ tests/qemu-iotests/024.out | 43 + tests/qemu-iotests/271 | 66 ++ tests/qemu-iotests/271.out | 42 4 files changed, 211 insertions(+) Hi! Seems like this patch now breaks the iotests when running with -qed : $ ./check -qed 024 QEMU -- ".../qemu-build/qemu-system-x86_64" -nodefaults -display none -accel qtest QEMU_IMG -- ".../qemu-build/qemu-img" QEMU_IO -- ".../qemu-build/qemu-io" --cache writeback --aio threads -f qed QEMU_NBD -- ".../qemu-build/qemu-nbd" IMGFMT-- qed IMGPROTO -- file PLATFORM -- Linux/x86_64 thuth-p1g4 6.9.9-200.fc40.x86_64 TEST_DIR -- .../qemu-build/tests/qemu-iotests/scratch SOCK_DIR -- /tmp/qemu-iotests-b84qth8b GDB_OPTIONS -- VALGRIND_QEMU -- PRINT_QEMU_OUTPUT -- 024 fail [09:14:06] [09:14:09] 2.9s output mismatch (see .../qemu-build/tests/qemu-iotests/scratch/qed-file-024/024.out.bad) --- .../qemu/tests/qemu-iotests/024.out +++ .../qemu-build/tests/qemu-iotests/scratch/qed-file-024/024.out.bad @@ -214,7 +214,6 @@ virtual size: 384 KiB (393216 bytes) cluster_size: 131072 backing file: TEST_DIR/subdir/t.IMGFMT.base_old -backing file format: IMGFMT Fill backing files with data Failures: 024 Failed 1 of 1 iotests Could you please have a look at it? Thanks, Thomas
[PATCH] tests/avocado: Remove the remainders of the virtiofs_submounts test
The virtiofs_submounts test has been removed in commit 5da7701e2a ("virtiofsd: Remove test"), so we don't need this files anymore. Signed-off-by: Thomas Huth --- .../virtiofs_submounts.py.data/cleanup.sh | 46 -- .../guest-cleanup.sh | 30 .../virtiofs_submounts.py.data/guest.sh | 138 -- .../virtiofs_submounts.py.data/host.sh| 127 4 files changed, 341 deletions(-) delete mode 100644 tests/avocado/virtiofs_submounts.py.data/cleanup.sh delete mode 100644 tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh delete mode 100644 tests/avocado/virtiofs_submounts.py.data/guest.sh delete mode 100644 tests/avocado/virtiofs_submounts.py.data/host.sh diff --git a/tests/avocado/virtiofs_submounts.py.data/cleanup.sh b/tests/avocado/virtiofs_submounts.py.data/cleanup.sh deleted file mode 100644 index 2a6579a0fe..00 --- a/tests/avocado/virtiofs_submounts.py.data/cleanup.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -function print_usage() -{ -if [ -n "$2" ]; then -echo "Error: $2" -echo -fi -echo "Usage: $1 " -} - -scratch_dir=$1 -if [ -z "$scratch_dir" ]; then -print_usage "$0" 'Scratch dir not given' >&2 -exit 1 -fi - -cd "$scratch_dir/share" || exit 1 -mps=(mnt*) -mp_i=0 -for mp in "${mps[@]}"; do -mp_i=$((mp_i + 1)) -printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}" - -sudo umount -R "$mp" -rm -rf "$mp" -done -echo - -rm some-file -cd .. -rmdir share - -imgs=(fs*.img) -img_i=0 -for img in "${imgs[@]}"; do -img_i=$((img_i + 1)) -printf "Detaching and deleting %i/%i...\r" "$img_i" "${#imgs[@]}" - -dev=$(losetup -j "$img" | sed -e 's/:.*//') -sudo losetup -d "$dev" -rm -f "$img" -done -echo - -echo 'Done.' diff --git a/tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh b/tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh deleted file mode 100644 index 729cb2d1a5..00 --- a/tests/avocado/virtiofs_submounts.py.data/guest-cleanup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -function print_usage() -{ -if [ -n "$2" ]; then -echo "Error: $2" -echo -fi -echo "Usage: $1 " -} - -scratch_dir=$1 -if [ -z "$scratch_dir" ]; then -print_usage "$0" 'Scratch dir not given' >&2 -exit 1 -fi - -cd "$scratch_dir/share" || exit 1 - -mps=(mnt*) -mp_i=0 -for mp in "${mps[@]}"; do -mp_i=$((mp_i + 1)) -printf "Unmounting %i/%i...\r" "$mp_i" "${#mps[@]}" - -sudo umount -R "$mp" -done -echo - -echo 'Done.' diff --git a/tests/avocado/virtiofs_submounts.py.data/guest.sh b/tests/avocado/virtiofs_submounts.py.data/guest.sh deleted file mode 100644 index 59ba40fde1..00 --- a/tests/avocado/virtiofs_submounts.py.data/guest.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - -function print_usage() -{ -if [ -n "$2" ]; then -echo "Error: $2" -echo -fi -echo "Usage: $1 " -echo '(The shared directory is the "share" directory in the scratch' \ - 'directory)' -} - -shared_dir=$1 -if [ -z "$shared_dir" ]; then -print_usage "$0" 'Shared dir not given' >&2 -exit 1 -fi - -cd "$shared_dir" - -# FIXME: This should not be necessary, but it is. In order for all -# submounts to be proper mount points, we need to visit them. -# (Before we visit them, they will not be auto-mounted, and so just -# appear as normal directories, with the catch that their st_ino will -# be the st_ino of the filesystem they host, while the st_dev will -# still be the st_dev of the parent.) -# `find` does not work, because it will refuse to touch the mount -# points as long as they are not mounted; their st_dev being shared -# with the parent and st_ino just being the root node's inode ID -# will practically ensure that this node exists elsewhere on the -# filesystem, and `find` is required to recognize loops and not to -# follow them. -# Thus, we have to manually visit all nodes first. - -mnt_i=0 - -function recursively_visit() -{ -pushd "$1" >/dev/null -for entry in *; do -if [[ "$entry" == mnt* ]]; then -mnt_i=$((mnt_i + 1)) -printf "Triggering auto-mount $mnt_i...\r" -fi - -if [ -d "$entry" ]; then -recursively_visit "$entry" -fi -done -popd >/dev/null -} - -recursively_visit . -echo - - -if [ -n "$(find -name not-mounted)" ]; then -echo &qu
Re: [PATCH v3 9/9] tests/qtest: Delete previous boot file
On 08/07/2024 08.55, Akihiko Odaki wrote: A test run may create boot files several times. Delete the previous boot file before creating a new one. Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin --- tests/qtest/migration-test.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) Acked-by: Thomas Huth
[PATCH] system: Enable the device aliases for or1k, too
Now that we've got a "virt" machine for or1k that supports PCI, too, we can also enable the virtio device aliases like we do on other similar platforms. This will e.g. help to run the iotests with qemu-system-or1k later. While we're at it, sort QEMU_ARCH_LOONGARCH alphabetically into the list. Signed-off-by: Thomas Huth --- system/qdev-monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 6af6ef7d66..60c3b6ad96 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -57,10 +57,10 @@ typedef struct QDevAlias /* default virtio transport per architecture */ #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ - QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ + QEMU_ARCH_LOONGARCH | QEMU_ARCH_MIPS | \ + QEMU_ARCH_OPENRISC | QEMU_ARCH_PPC | \ QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ - QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA | \ - QEMU_ARCH_LOONGARCH) + QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) #define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) #define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) -- 2.45.2
Re: [PATCH v2 13/15] tests/qtest: Delete previous boot file
On 27/06/2024 15.37, Akihiko Odaki wrote: A test run may create boot files several times. Delete the previous boot file before creating a new one. Signed-off-by: Akihiko Odaki --- tests/qtest/migration-test.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b7e3406471a6..5c0d669b6df3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -129,12 +129,23 @@ static char *bootpath; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" +static void bootfile_delete(void) +{ +unlink(bootpath); +g_free(bootpath); +bootpath = NULL; +} + static void bootfile_create(char *dir, bool suspend_me) { const char *arch = qtest_get_arch(); unsigned char *content; size_t len; +if (bootpath) { +bootfile_delete(); +} + bootpath = g_strdup_printf("%s/bootsect", dir); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { /* the assembled x86 boot sector should be exactly one sector large */ @@ -164,13 +175,6 @@ static void bootfile_create(char *dir, bool suspend_me) fclose(bootfile); } -static void bootfile_delete(void) -{ -unlink(bootpath); -g_free(bootpath); -bootpath = NULL; -} - /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's I think the better fix would be to call bootfile_create() only once from main() since we don't have to create the bootfile multiple times, do we? Thomas
Re: [PATCH v2 00/15] Fix check-qtest-ppc64 sanitizer errors
On 02/07/2024 00.23, BALATON Zoltan wrote: On Mon, 1 Jul 2024, Michael S. Tsirkin wrote: On Thu, Jun 27, 2024 at 10:37:43PM +0900, Akihiko Odaki wrote: Based-on: <3ad18bc590ef28e1526e8053568086b453e7ffde.1718211878.git.quic_mathb...@quicinc.com> ("[PATCH] cpu: fix memleak of 'halt_cond' and 'thread'") I saw various sanitizer errors when running check-qtest-ppc64. While I could just turn off sanitizers, I decided to tackle them this time. Unfortunately, GLib does not free test data in some cases so some sanitizer errors remain. All sanitizer errors will be gone with this patch series combined with the following change for GLib: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4120 Signed-off-by: Akihiko Odaki Reviewed-by: Michael S. Tsirkin who's merging all this? Maybe needs to be split. Mark had an alternative for macio which was picked up by Philippe if I'm not mistaken. I've sent an alternative for vt82c686 which is still discussed but could belong to Philippe as well. PPC parts could be taken by the PPC maintainers if there were any active at the moment and I don't know who maintains tests normally or other misc areas. I can take the qtest patches through my tree. Thomas
Re: [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full()
On 27/06/2024 15.37, Akihiko Odaki wrote: A test function may not be executed depending on the test command line so it is wrong to free data with a test function. Use qtest_add_data_func_full() to register a function to free data. Signed-off-by: Akihiko Odaki --- tests/qtest/device-introspect-test.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) Reviewed-by: Thomas Huth
Re: [PATCH v3 15/17] tests/qtest: Disable npcm7xx_sdhci tests using hardcoded RCA
On 27/06/2024 18.22, Philippe Mathieu-Daudé wrote: Disable tests using 0x4567 hardcoded RCA otherwise when using random RCA we get: ERROR:../../tests/qtest/npcm7xx_sdhci-test.c:69:write_sdread: assertion failed: (ret == len) not ok /arm/npcm7xx_sdhci/read_sd - ERROR:../../tests/qtest/npcm7xx_sdhci-test.c:69:write_sdread: assertion failed: (ret == len) Bail out! See https://lore.kernel.org/qemu-devel/37f83be9-deb5-42a1-b704-14984351d...@linaro.org/ Signed-off-by: Philippe Mathieu-Daudé --- Cc: Hao Wu Cc: Shengtan Mao Cc: Tyrone Ting --- tests/qtest/npcm7xx_sdhci-test.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c index 5d68540e52..6a42b142ad 100644 --- a/tests/qtest/npcm7xx_sdhci-test.c +++ b/tests/qtest/npcm7xx_sdhci-test.c @@ -44,6 +44,7 @@ static QTestState *setup_sd_card(void) sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x4120, 0, (41 << 8)); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID); sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR); +g_test_skip("hardcoded 0x4567 card address"); This g_test_skip here does not make too much sense (since you're doing it in the caller site, too) ... could you please replace it with a proper comment why this code needs to be reworked? Thanks! Thomas sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x4567, 0, SDHC_SELECT_DESELECT_CARD); @@ -76,6 +77,9 @@ static void test_read_sd(void) { QTestState *qts = setup_sd_card(); +g_test_skip("hardcoded 0x4567 card address used in setup_sd_card()"); +return; + write_sdread(qts, "hello world"); write_sdread(qts, "goodbye"); @@ -108,6 +112,9 @@ static void test_write_sd(void) { QTestState *qts = setup_sd_card(); +g_test_skip("hardcoded 0x4567 card address used in setup_sd_card()"); +return; + sdwrite_read(qts, "hello world"); sdwrite_read(qts, "goodbye");
Re: [PATCH] tests/avocado: add hotplug_blk test
On 09/04/2024 08.58, Vladimir Sementsov-Ogievskiy wrote: Introduce a test, that checks that plug/unplug of virtio-blk device works. (the test is developed by copying hotplug_cpu.py, so keep original copyright) Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/avocado/hotplug_blk.py | 69 1 file changed, 69 insertions(+) create mode 100644 tests/avocado/hotplug_blk.py diff --git a/tests/avocado/hotplug_blk.py b/tests/avocado/hotplug_blk.py new file mode 100644 index 00..5dc30f6616 --- /dev/null +++ b/tests/avocado/hotplug_blk.py @@ -0,0 +1,69 @@ +# Functional test that hotplugs a virtio blk disk and checks it on a Linux +# guest +# +# Copyright (c) 2021 Red Hat, Inc. +# Copyright (c) Yandex +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import time + +from avocado_qemu import LinuxTest + + +class HotPlug(LinuxTest): +def blockdev_add(self) -> None: +self.vm.cmd('blockdev-add', **{ +'driver': 'null-co', +'size': 1073741824, +'node-name': 'disk' +}) + +def assert_vda(self) -> None: +self.ssh_command('test -e /sys/block/vda') + +def assert_no_vda(self) -> None: +with self.assertRaises(AssertionError): +self.assert_vda() + +def plug(self) -> None: +args = { +'driver': 'virtio-blk-pci', +'drive': 'disk', +'id': 'virtio-disk0', +'bus': 'pci.1', +'addr': 1 +} + +self.assert_no_vda() +self.vm.cmd('device_add', args) +try: +self.assert_vda() +except AssertionError: +time.sleep(1) +self.assert_vda() + +def unplug(self) -> None: +self.vm.cmd('device_del', id='virtio-disk0') + +self.vm.event_wait('DEVICE_DELETED', 1.0, + match={'data': {'device': 'virtio-disk0'}}) + +self.assert_no_vda() + +def test(self) -> None: +""" +:avocado: tags=arch:x86_64 +:avocado: tags=machine:q35 +:avocado: tags=accel:kvm +""" + self.require_accelerator('kvm') +self.vm.add_args('-accel', 'kvm') +self.vm.add_args('-device', 'pcie-pci-bridge,id=pci.1,bus=pcie.0') + +self.launch_and_wait() +self.blockdev_add() + +self.plug() +self.unplug() Reviewed-by: Thomas Huth
Re: [PATCH] Use "void *" as parameter for functions that are used for aio_set_event_notifier()
On 29/05/2024 20.22, Stefan Hajnoczi wrote: On Wed, May 29, 2024 at 07:49:48PM +0200, Thomas Huth wrote: aio_set_event_notifier() and aio_set_event_notifier_poll() in util/aio-posix.c and util/aio-win32.c are casting function pointers of functions that take an "EventNotifier *" pointer as parameter to function pointers that take a "void *" pointer as parameter (i.e. the IOHandler type). When those function pointers are later used to call the referenced function, this triggers undefined behavior errors with the latest version of Clang in Fedora 40 when compiling with the option "-fsanitize=undefined". And this also prevents enabling the strict mode of CFI which is currently disabled with -fsanitize-cfi-icall-generalize-pointers. Thus let us avoid the problem by using "void *" as parameter in all spots where it is needed. Signed-off-by: Thomas Huth --- Yes, I know, the patch looks ugly ... but I don't see a better way to tackle this. If someone has a better idea, suggestions are welcome! An alternative is adding EventNotifierHandler *io_read, *io_poll_ready, *io_poll_begin, and *io_poll_end fields to EventNotifier so that aio_set_event_notifier() and aio_set_event_notifier_poll() can pass helper functions to the underlying aio_set_fd_handler() and aio_set_fd_poll() APIs. These helper functions then invoke the EventNotifier callbacks: /* Helpers */ static void event_notifier_io_read(void *opaque) { EventNotifier *notifier = opaque; notifier->io_read(notifier); } That's a nice idea, thanks, I'll give it a try! Thomas
[PATCH] Use "void *" as parameter for functions that are used for aio_set_event_notifier()
aio_set_event_notifier() and aio_set_event_notifier_poll() in util/aio-posix.c and util/aio-win32.c are casting function pointers of functions that take an "EventNotifier *" pointer as parameter to function pointers that take a "void *" pointer as parameter (i.e. the IOHandler type). When those function pointers are later used to call the referenced function, this triggers undefined behavior errors with the latest version of Clang in Fedora 40 when compiling with the option "-fsanitize=undefined". And this also prevents enabling the strict mode of CFI which is currently disabled with -fsanitize-cfi-icall-generalize-pointers. Thus let us avoid the problem by using "void *" as parameter in all spots where it is needed. Signed-off-by: Thomas Huth --- Yes, I know, the patch looks ugly ... but I don't see a better way to tackle this. If someone has a better idea, suggestions are welcome! include/block/aio.h| 8 include/hw/virtio/virtio.h | 2 +- include/qemu/main-loop.h | 3 +-- block/linux-aio.c | 6 +++--- block/nvme.c | 8 block/win32-aio.c | 4 ++-- hw/hyperv/hyperv.c | 6 +++--- hw/hyperv/hyperv_testdev.c | 5 +++-- hw/hyperv/vmbus.c | 8 hw/nvme/ctrl.c | 8 hw/usb/ccid-card-emulated.c| 5 +++-- hw/virtio/vhost-shadow-virtqueue.c | 11 ++- hw/virtio/vhost.c | 5 +++-- hw/virtio/virtio.c | 26 ++ tests/unit/test-aio.c | 9 + tests/unit/test-nested-aio-poll.c | 8 util/aio-posix.c | 14 ++ util/aio-win32.c | 10 +- util/async.c | 6 +++--- util/main-loop.c | 3 +-- 20 files changed, 79 insertions(+), 76 deletions(-) diff --git a/include/block/aio.h b/include/block/aio.h index 8378553eb9..01e7ea069d 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -476,9 +476,9 @@ void aio_set_fd_handler(AioContext *ctx, */ void aio_set_event_notifier(AioContext *ctx, EventNotifier *notifier, -EventNotifierHandler *io_read, +IOHandler *io_read, AioPollFn *io_poll, -EventNotifierHandler *io_poll_ready); +IOHandler *io_poll_ready); /* * Set polling begin/end callbacks for an event notifier that has already been @@ -491,8 +491,8 @@ void aio_set_event_notifier(AioContext *ctx, */ void aio_set_event_notifier_poll(AioContext *ctx, EventNotifier *notifier, - EventNotifierHandler *io_poll_begin, - EventNotifierHandler *io_poll_end); + IOHandler *io_poll_begin, + IOHandler *io_poll_end); /* Return a GSource that lets the main loop poll the file descriptors attached * to this AioContext. diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 7d5ffdc145..e98cecfdd7 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -396,7 +396,7 @@ void virtio_device_release_ioeventfd(VirtIODevice *vdev); bool virtio_device_ioeventfd_enabled(VirtIODevice *vdev); EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq); void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled); -void virtio_queue_host_notifier_read(EventNotifier *n); +void virtio_queue_host_notifier_read(void *n); void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx); void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ctx); void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx); diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 5764db157c..ba73a0c6da 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -241,8 +241,7 @@ void qemu_set_fd_handler(int fd, * @handler: A level-triggered callback that is fired when @e * has been set. @e is passed to it as a parameter. */ -void event_notifier_set_handler(EventNotifier *e, -EventNotifierHandler *handler); +void event_notifier_set_handler(EventNotifier *e, IOHandler *handler); GSource *iohandler_get_g_source(void); AioContext *iohandler_get_aio_context(void); diff --git a/block/linux-aio.c b/block/linux-aio.c index ec05d946f3..61f796f7e0 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -253,9 +253,9 @@ static void qemu_laio_completion_bh(void *opaque) qemu_laio_process_completions_and_submit(s); } -static void qemu_laio_completion_cb(EventNotifier *e) +static void qemu_laio_completion_cb(void *e) { -LinuxA
Re: [PULL 10/38] tests/qtest/migration: Add a test for the analyze-migration script
On 22/05/2024 14.48, Fabiano Rosas wrote: Thomas Huth writes: On 21/05/2024 14.46, Fabiano Rosas wrote: Alex Bennée writes: Juan Quintela writes: From: Fabiano Rosas Add a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags. After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is. Signed-off-by: Fabiano Rosas Acked-by: Thomas Huth Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Message-ID: <20231009184326.15777-7-faro...@suse.de> I bisected the failures I'm seeing on s390x to the introduction of this script. I don't know if its simply a timeout on a relatively slow VM: What's the range of your bisect? That test has been disabled and then reenabled on s390x. It could be tripping the bisect. 04131e0009 ("tests/qtest/migration-test: Disable the analyze-migration.py test on s390x") 81c2c9dd5d ("tests/qtest/migration-test: Fix analyze-migration.py for s390x") I don't think that test itself could be timing out. It's a very simple test. It runs a migration and then uses the output to validate the script. Agreed, the analyze-migration.py is unlikely to be the issue - especially since it seems to have been disabled again in commit 6f0771de903b ... Fabiano, why did you disable it here again? The reason is not mentioned in the commit description. Your patch 81c2c9dd5d was merged between my v1 and v2 on the list and I didn't notice so I messed up the rebase. I'll send a patch soon to fix that. Thanks, but I already sent a patch earlier today that should fix the issue: https://lore.kernel.org/qemu-devel/20240522091255.417263-1-th...@redhat.com/T/#u Thomas
Re: [PULL 10/38] tests/qtest/migration: Add a test for the analyze-migration script
On 21/05/2024 14.46, Fabiano Rosas wrote: Alex Bennée writes: Juan Quintela writes: From: Fabiano Rosas Add a smoke test that migrates to a file and gives it to the script. It should catch the most annoying errors such as changes in the ram flags. After code has been merged it becomes way harder to figure out what is causing the script to fail, the person making the change is the most likely to know right away what the problem is. Signed-off-by: Fabiano Rosas Acked-by: Thomas Huth Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Message-ID: <20231009184326.15777-7-faro...@suse.de> I bisected the failures I'm seeing on s390x to the introduction of this script. I don't know if its simply a timeout on a relatively slow VM: What's the range of your bisect? That test has been disabled and then reenabled on s390x. It could be tripping the bisect. 04131e0009 ("tests/qtest/migration-test: Disable the analyze-migration.py test on s390x") 81c2c9dd5d ("tests/qtest/migration-test: Fix analyze-migration.py for s390x") I don't think that test itself could be timing out. It's a very simple test. It runs a migration and then uses the output to validate the script. Agreed, the analyze-migration.py is unlikely to be the issue - especially since it seems to have been disabled again in commit 6f0771de903b ... Fabiano, why did you disable it here again? The reason is not mentioned in the commit description. But with regards to the failures, please note that we also had a bug recently, starting with commit 9d1b0f5bf515a0 and just fixed in commit bebe9603fcb072dc ... maybe that affected your bisecting, too. (it's really bad that this bug sneaked in without being noticed ... we should maybe look into running at least some of the migration tests with TCG on x86 hosts, too...) Thomas
Re: [PATCH v4 12/12] tests/qtest/vhost-user-test: add a test case for memory-backend-shm
On 08/05/2024 09.44, Stefano Garzarella wrote: `memory-backend-shm` can be used with vhost-user devices, so let's add a new test case for it. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-test.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index d4e437265f..8c1d903b2a 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -44,6 +44,8 @@ "mem-path=%s,share=on -numa node,memdev=mem" #define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=mem,size=%dM," \ " -numa node,memdev=mem" +#define QEMU_CMD_SHM" -m %d -object memory-backend-shm,id=mem,size=%dM," \ +" -numa node,memdev=mem" #define QEMU_CMD_CHR" -chardev socket,id=%s,path=%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=hs0,chardev=%s,vhostforce=on" @@ -195,6 +197,7 @@ enum test_memfd { TEST_MEMFD_AUTO, TEST_MEMFD_YES, TEST_MEMFD_NO, +TEST_MEMFD_SHM, }; static void append_vhost_net_opts(TestServer *s, GString *cmd_line, @@ -228,6 +231,8 @@ static void append_mem_opts(TestServer *server, GString *cmd_line, if (memfd == TEST_MEMFD_YES) { g_string_append_printf(cmd_line, QEMU_CMD_MEMFD, size, size); +} else if (memfd == TEST_MEMFD_SHM) { +g_string_append_printf(cmd_line, QEMU_CMD_SHM, size, size); } else { const char *root = init_hugepagefs() ? : server->tmpfs; @@ -788,6 +793,19 @@ static void *vhost_user_test_setup_memfd(GString *cmd_line, void *arg) return server; } +static void *vhost_user_test_setup_shm(GString *cmd_line, void *arg) +{ +TestServer *server = test_server_new("vhost-user-test", arg); +test_server_listen(server); + +append_mem_opts(server, cmd_line, 256, TEST_MEMFD_SHM); +server->vu_ops->append_opts(server, cmd_line, ""); + +g_test_queue_destroy(vhost_user_test_cleanup, server); + +return server; +} + static void test_read_guest_mem(void *obj, void *arg, QGuestAllocator *alloc) { TestServer *server = arg; @@ -1081,6 +1099,11 @@ static void register_vhost_user_test(void) "virtio-net", test_read_guest_mem, &opts); +opts.before = vhost_user_test_setup_shm; +qos_add_test("vhost-user/read-guest-mem/shm", + "virtio-net", + test_read_guest_mem, &opts); + if (qemu_memfd_check(MFD_ALLOW_SEALING)) { opts.before = vhost_user_test_setup_memfd; qos_add_test("vhost-user/read-guest-mem/memfd", Acked-by: Thomas Huth
Re: [PATCH v4 11/12] tests/qtest/vhost-user-blk-test: use memory-backend-shm
On 08/05/2024 09.44, Stefano Garzarella wrote: `memory-backend-memfd` is available only on Linux while the new `memory-backend-shm` can be used on any POSIX-compliant operating system. Let's use it so we can run the test in multiple environments. Signed-off-by: Stefano Garzarella --- tests/qtest/vhost-user-blk-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 117b9acd10..e945f6abf2 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -906,7 +906,7 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, vhost_user_blk_bin); g_string_append_printf(cmd_line, -" -object memory-backend-memfd,id=mem,size=256M,share=on " +" -object memory-backend-shm,id=mem,size=256M,share=on " " -M memory-backend=mem -m 256M "); for (i = 0; i < vus_instances; i++) { Acked-by: Thomas Huth
Re: [PULL 1/1] hw/ufs: Fix buffer overflow bug
On 30/04/2024 06.32, Thomas Huth wrote: On 30/04/2024 02.17, Richard Henderson wrote: On 4/28/24 20:25, Jeuk Kim wrote: From: Jeuk Kim It fixes the buffer overflow vulnerability in the ufs device. The bug was detected by sanitizers. You can reproduce it by: cat << EOF |\ qemu-system-x86_64 \ -display none -machine accel=qtest -m 512M -M q35 -nodefaults -drive \ file=null-co://,if=none,id=disk0 -device ufs,id=ufs_bus -device \ ufs-lu,drive=disk0,bus=ufs_bus -qtest stdio outl 0xcf8 0x8810 outl 0xcfc 0xe000 outl 0xcf8 0x8804 outw 0xcfc 0x06 write 0xe058 0x1 0xa7 write 0xa 0x1 0x50 EOF Resolves: #2299 Fixes: 329f16624499 ("hw/ufs: Support for Query Transfer Requests") Reported-by: Zheyu Ma Signed-off-by: Jeuk Kim --- hw/ufs/ufs.c | 8 1 file changed, 8 insertions(+) For some reason this appears to cause failures on s390x: https://gitlab.com/qemu-project/qemu/-/jobs/6740883283 All of the timeouts are new with this patch alone applied, and go away when reverted. I wasn't aware that these tests used ufs, but I have no other explanation... I don't know for sure, but the test failure might instead be related to the problem that gets fixed by https://lore.kernel.org/qemu-devel/20240429075908.36302-1-th...@redhat.com/ ... I'm preparing a pull request for that fix right now, so maybe you could try this ufs pull request afterwards again to see whether the problem is fixed? Hmm, thinking about it twice, it cannot be the reason: That bug affects aarch64/arm only, and in above CI run, some other targets were failing. So the problem must be something else, indeed. Thomas
Re: [PULL 1/1] hw/ufs: Fix buffer overflow bug
On 30/04/2024 02.17, Richard Henderson wrote: On 4/28/24 20:25, Jeuk Kim wrote: From: Jeuk Kim It fixes the buffer overflow vulnerability in the ufs device. The bug was detected by sanitizers. You can reproduce it by: cat << EOF |\ qemu-system-x86_64 \ -display none -machine accel=qtest -m 512M -M q35 -nodefaults -drive \ file=null-co://,if=none,id=disk0 -device ufs,id=ufs_bus -device \ ufs-lu,drive=disk0,bus=ufs_bus -qtest stdio outl 0xcf8 0x8810 outl 0xcfc 0xe000 outl 0xcf8 0x8804 outw 0xcfc 0x06 write 0xe058 0x1 0xa7 write 0xa 0x1 0x50 EOF Resolves: #2299 Fixes: 329f16624499 ("hw/ufs: Support for Query Transfer Requests") Reported-by: Zheyu Ma Signed-off-by: Jeuk Kim --- hw/ufs/ufs.c | 8 1 file changed, 8 insertions(+) For some reason this appears to cause failures on s390x: https://gitlab.com/qemu-project/qemu/-/jobs/6740883283 All of the timeouts are new with this patch alone applied, and go away when reverted. I wasn't aware that these tests used ufs, but I have no other explanation... I don't know for sure, but the test failure might instead be related to the problem that gets fixed by https://lore.kernel.org/qemu-devel/20240429075908.36302-1-th...@redhat.com/ ... I'm preparing a pull request for that fix right now, so maybe you could try this ufs pull request afterwards again to see whether the problem is fixed? Thomas
[PATCH v3 06/13] ci: move external build environment setups to CentOS Stream 9
From: Paolo Bonzini RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Thus upgrade our CentOS Stream build environment playbooks to major version 9 now. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240412103708.27650-1-pbonz...@redhat.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- .../stream/{8 => 9}/build-environment.yml | 31 ++--- .../stream/{8 => 9}/x86_64/configure | 4 +- .../stream/{8 => 9}/x86_64/test-avocado | 0 scripts/ci/setup/build-environment.yml| 44 +++ 4 files changed, 34 insertions(+), 45 deletions(-) rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%) diff --git a/scripts/ci/org.centos/stream/8/build-environment.yml b/scripts/ci/org.centos/stream/9/build-environment.yml similarity index 75% rename from scripts/ci/org.centos/stream/8/build-environment.yml rename to scripts/ci/org.centos/stream/9/build-environment.yml index 1ead77e2cb..cd29fe6f27 100644 --- a/scripts/ci/org.centos/stream/8/build-environment.yml +++ b/scripts/ci/org.centos/stream/9/build-environment.yml @@ -2,32 +2,32 @@ - name: Installation of extra packages to build QEMU hosts: all tasks: -- name: Extra check for CentOS Stream 8 +- name: Extra check for CentOS Stream 9 lineinfile: path: /etc/redhat-release -line: CentOS Stream release 8 +line: CentOS Stream release 9 state: present check_mode: yes - register: centos_stream_8 + register: centos_stream_9 -- name: Enable EPEL repo on CentOS Stream 8 +- name: Enable EPEL repo on CentOS Stream 9 dnf: name: - epel-release state: present when: -- centos_stream_8 +- centos_stream_9 -- name: Enable PowerTools repo on CentOS Stream 8 +- name: Enable CRB repo on CentOS Stream 9 ini_file: -path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo -section: powertools +path: /etc/yum.repos.d/centos.repo +section: crb option: enabled value: "1" when: -- centos_stream_8 +- centos_stream_9 -- name: Install basic packages to build QEMU on CentOS Stream 8 +- name: Install basic packages to build QEMU on CentOS Stream 9 dnf: name: - bzip2 @@ -42,7 +42,6 @@ - gettext - git - glib2-devel - - glusterfs-api-devel - gnutls-devel - libaio-devel - libcap-ng-devel @@ -61,22 +60,24 @@ - lzo-devel - make - mesa-libEGL-devel + - meson - nettle-devel - ninja-build - nmap-ncat - numactl-devel - pixman-devel - - python38 + - python3 + - python3-pip - python3-sphinx + - python3-sphinx_rtd_theme + - python3-tomli - rdma-core-devel - redhat-rpm-config - snappy-devel - - spice-glib-devel - - spice-server-devel - systemd-devel - systemtap-sdt-devel - tar - zlib-devel state: present when: -- centos_stream_8 +- centos_stream_9 diff --git a/scripts/ci/org.centos/stream/8/x86_64/configure b/scripts/ci/org.centos/stream/9/x86_64/configure similarity index 98% rename from scripts/ci/org.centos/stream/8/x86_64/configure rename to scripts/ci/org.centos/stream/9/x86_64/configure index 76781f17f4..1b6f40fd78 100755 --- a/scripts/ci/org.centos/stream/8/x86_64/configure +++ b/scripts/ci/org.centos/stream/9/x86_64/configure @@ -16,7 +16,7 @@ # that patches adding downstream specific devices are not available. # ../configure \ ---python=/usr/bin/python3.8 \ +--python=/usr/bin/python3.9 \ --prefix="/usr" \ --libdir="/usr/lib64" \ --datadir="/usr/share" \ @@ -157,7 +157,6 @@ --enable-docs \ --enable-fdt \ --enable-gcrypt \ ---enable-glusterfs \ --enable-gnutls \ --enable-guest-agent \ --enable-iconv \ @@ -180,7 +179,6 @@ --enable-seccomp \ --enable-snappy \ --enable-smartcard \ ---enable-spice \ --enable-system \ --enable-tcg \ --enable-tools \ diff --git a/scripts/ci/org.centos/stream/8/x86_64/test-avocado b/scripts/ci/org.centos/stream/9/x86_64/test-avocado similarity index 100% rename from scripts/ci/org.centos/stream/8/x86_64/test-avocado rename to scripts/ci/org.centos/stream/9/x86_64/test-avocado diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml index f344d1a850..9b7d96c01b 10064
[PATCH v3 08/13] Remove glib compatibility code that is not required anymore
Now that we bumped the minumum glib version to 2.66, we can drop the old code. Suggested-by: Paolo Bonzini Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- qga/commands-posix-ssh.c | 8 util/error-report.c | 10 -- 2 files changed, 18 deletions(-) diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index b0e0b1d674..cc1f5a708e 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -288,7 +288,6 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp) } #ifdef QGA_BUILD_UNIT_TEST -#if GLIB_CHECK_VERSION(2, 60, 0) static const strList test_key2 = { .value = (char *)"algo key2 comments" }; @@ -484,11 +483,4 @@ int main(int argc, char *argv[]) return g_test_run(); } -#else -int main(int argc, char *argv[]) -{ -g_test_message("test skipped, needs glib >= 2.60"); -return 0; -} -#endif /* GLIB_2_60 */ #endif /* BUILD_UNIT_TEST */ diff --git a/util/error-report.c b/util/error-report.c index 6e44a55732..1b17c11de1 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -172,18 +172,8 @@ static void print_loc(void) static char * real_time_iso8601(void) { -#if GLIB_CHECK_VERSION(2,62,0) g_autoptr(GDateTime) dt = g_date_time_new_now_utc(); -/* ignore deprecation warning, since GLIB_VERSION_MAX_ALLOWED is 2.56 */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" return g_date_time_format_iso8601(dt); -#pragma GCC diagnostic pop -#else -GTimeVal tv; -g_get_current_time(&tv); -return g_time_val_to_iso8601(&tv); -#endif } /* -- 2.44.0
[PATCH v3 12/13] block/ssh: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. While we're at it, also emit a warning when encountering unknown parameters in the URI, so that the users have a chance to detect their typos or other mistakes. Reviewed-by: Richard W.M. Jones Signed-off-by: Thomas Huth --- block/ssh.c | 75 - 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/block/ssh.c b/block/ssh.c index 2748253d4a..a88171d4b5 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -37,7 +37,6 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" -#include "qemu/uri.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" @@ -181,65 +180,71 @@ static void sftp_error_trace(BDRVSSHState *s, const char *op) static int parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +const char *uri_host, *uri_path, *uri_user, *uri_query; char *port_str; -int i; +int port; +g_autoptr(GError) gerror = NULL; +char *qp_name, *qp_value; +GUriParamsIter qp; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } -if (g_strcmp0(uri->scheme, "ssh") != 0) { +if (g_strcmp0(g_uri_get_scheme(uri), "ssh") != 0) { error_setg(errp, "URI scheme must be 'ssh'"); -goto err; +return -EINVAL; } -if (!uri->server || strcmp(uri->server, "") == 0) { +uri_host = g_uri_get_host(uri); +if (!uri_host || g_str_equal(uri_host, "")) { error_setg(errp, "missing hostname in URI"); -goto err; +return -EINVAL; } -if (!uri->path || strcmp(uri->path, "") == 0) { +uri_path = g_uri_get_path(uri); +if (!uri_path || g_str_equal(uri_path, "")) { error_setg(errp, "missing remote path in URI"); -goto err; -} - -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto err; +return -EINVAL; } -if(uri->user && strcmp(uri->user, "") != 0) { -qdict_put_str(options, "user", uri->user); +uri_user = g_uri_get_user(uri); +if (uri_user && !g_str_equal(uri_user, "")) { +qdict_put_str(options, "user", uri_user); } -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_host); -port_str = g_strdup_printf("%d", uri->port ?: 22); +port = g_uri_get_port(uri); +port_str = g_strdup_printf("%d", port > 0 ? port : 22); qdict_put_str(options, "server.port", port_str); g_free(port_str); -qdict_put_str(options, "path", uri->path); - -/* Pick out any query parameters that we understand, and ignore - * the rest. - */ -for (i = 0; i < qp->n; ++i) { -if (strcmp(qp->p[i].name, "host_key_check") == 0) { -qdict_put_str(options, "host_key_check", qp->p[i].value); +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +if (!qp_name || !qp_value || gerror) { +warn_report("Failed to parse SSH URI parameters '%s'", +uri_query); +break; +} +/* + * Pick out the query parameters that we understand, and ignore + * (or rather warn about) the rest. + */ +if (g_str_equal(qp_name, "host_key_check")) { +qdict_put_str(options, "host_key_check", qp_value); +} else { +warn_report("Unsupported parameter '%s' in URI", qp_name); +} } } -query_params_free(qp); -uri_free(uri); return 0; - - err: -uri_free(uri); -return -EINVAL; } static bool ssh_has_filename_options_conflict(QDict *options, Error **errp) -- 2.44.0
[PATCH v3 04/13] tests: Update our CI to use CentOS Stream 9 instead of 8
RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Another reason for doing this is that Centos Stream 8 will go EOL soon: https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/ "After May 31, 2024, CentOS Stream 8 will be archived and no further updates will be provided." Thus upgrade our CentOS Stream container to major version 9 now. Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- .gitlab-ci.d/buildtest.yml| 16 - .gitlab-ci.d/container-core.yml | 4 +-- .../{centos8.docker => centos9.docker}| 34 +++ tests/lcitool/mappings.yml| 20 --- tests/lcitool/refresh | 2 +- tests/vm/centos | 4 +-- 6 files changed, 26 insertions(+), 54 deletions(-) rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index cfdff175c3..9f34c650d6 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -158,9 +158,9 @@ build-system-centos: - .native_build_job_template - .native_build_artifact_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server --enable-modules --enable-trace-backends=dtrace --enable-docs TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu @@ -242,7 +242,7 @@ check-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check avocado-system-centos: @@ -251,7 +251,7 @@ avocado-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check-avocado AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 arch:nios2 @@ -327,9 +327,9 @@ avocado-system-flaky: build-tcg-disabled: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 script: - mkdir build - cd build @@ -651,9 +651,9 @@ build-tci: build-without-defaults: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --without-default-devices --without-default-features diff --git a/.gitlab-ci.d/container-core.yml b/.gitlab-ci.d/container-core.yml index 08f8450fa1..5459447676 100644 --- a/.gitlab-ci.d/container-core.yml +++ b/.gitlab-ci.d/container-core.yml @@ -1,10 +1,10 @@ include: - local: '/.gitlab-ci.d/container-template.yml' -amd64-centos8-container: +amd64-centos9-container: extends: .container_job_template variables: -NAME: centos8 +NAME: centos9 amd64-fedora-container: extends: .container_job_template diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos9.docker similarity index 82% rename from tests/docker/dockerfiles/centos8.docker rename to tests/docker/dockerfiles/centos9.docker index ea618bf352..6cf47ce786 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos9.docker @@ -1,15 +1,14 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all centos-stream-8 qemu +# $ lcitool dockerfile --layers all centos-stream-9 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM quay.io/centos/centos:stream8 +FROM quay.io/centos/centos:stream9 RUN dnf distro-sync -y && \ dnf install 'dnf-command(config-manager)' -y && \ -dnf config-manager --set-enabled -y powertools && \ -dnf install -y centos-release-advanced-virtualization && \ +dnf config-manager --set-enabled -y crb && \ dnf install -y epel-release && \ dnf install -y epel-next-release && \ dnf install -y \ @@ -42,7 +41,6 @@ RUN dnf distro-sync -y && \ glib2-static \ glibc-langpack-en \ glibc-static \ -glusterfs-api-devel \ gnutls-devel \ gtk3-devel \ hostname \ @@ -82,6 +80,7 @@ RUN dnf distro-sync -y && \ lzo-devel \ make \ mesa-libgbm-devel \ +meson \ mtools \ ncurses-devel \ nettle-devel \ @@ -95,25 +94,25 @@ RUN dnf distro-sync -y && \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \ -python38 \ -python38-PyYAML \ -python38-numpy \ -
[PATCH v3 10/13] block/nbd: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too. Reviewed-by: Richard W.M. Jones Reviewed-by: Eric Blake Signed-off-by: Thomas Huth --- block/nbd.c | 76 ++--- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index ef05f7cdfd..589d28af83 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "trace.h" -#include "qemu/uri.h" #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" @@ -1514,30 +1513,31 @@ static void nbd_client_close(BlockDriverState *bs) static int nbd_parse_uri(const char *filename, QDict *options) { -URI *uri; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +g_autoptr(GHashTable) qp = NULL; const char *p; -QueryParams *qp = NULL; -int ret = 0; +int qp_n; bool is_unix; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } /* transport */ -if (!g_strcmp0(uri->scheme, "nbd")) { +uri_scheme = g_uri_get_scheme(uri); +if (!g_strcmp0(uri_scheme, "nbd")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+tcp")) { +} else if (!g_strcmp0(uri_scheme, "nbd+tcp")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+unix")) { +} else if (!g_strcmp0(uri_scheme, "nbd+unix")) { is_unix = true; } else { -ret = -EINVAL; -goto out; +return -EINVAL; } -p = uri->path ? uri->path : ""; +p = g_uri_get_path(uri) ?: ""; if (p[0] == '/') { p++; } @@ -1545,52 +1545,50 @@ static int nbd_parse_uri(const char *filename, QDict *options) qdict_put_str(options, "export", p); } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +return -EINVAL; +} +qp_n = g_hash_table_size(qp); +if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) { +return -EINVAL; +} + } + +uri_server = g_uri_get_host(uri); +if (uri_server && !uri_server[0]) { +uri_server = NULL; } +uri_port = g_uri_get_port(uri); if (is_unix) { /* nbd+unix:///export?socket=path */ -if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) { -ret = -EINVAL; -goto out; +const char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { +return -EINVAL; } qdict_put_str(options, "server.type", "unix"); -qdict_put_str(options, "server.path", qp->p[0].value); +qdict_put_str(options, "server.path", uri_socket); } else { -QString *host; char *port_str; /* nbd[+tcp]://host[:port]/export */ -if (!uri->server) { -ret = -EINVAL; -goto out; -} - -/* strip braces from literal IPv6 address */ -if (uri->server[0] == '[') { -host = qstring_from_substr(uri->server, 1, - strlen(uri->server) - 1); -} else { -host = qstring_from_str(uri->server); +if (!uri_server) { +return -EINVAL; } qdict_put_str(options, "server.type", "inet"); -qdict_put(options, "server.host", host); +qdict_put_str(options, "server.host", uri_server); -port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); +port_str = g_strdup_printf("%d", uri_port > 0 ? uri_port + : NBD_DEFAULT_PORT); qdict_put_str(options, "server.port", port_str); g_free(port_str); } -out: -if (qp) { -query_params_free(qp); -} -uri_free(uri); -return ret; +return 0; } static bool nbd_has_filename_options_conflict(QDict *options, Error **errp) -- 2.44.0
[PATCH v3 02/13] tests/lcitool/libvirt-ci: Update to the latest master branch
We need the latest fixes for the lcitool to be able to properly update our CentOS docker file to CentOS Stream 9. Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/lcitool/libvirt-ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci index 77c800186f..cec6703971 16 --- a/tests/lcitool/libvirt-ci +++ b/tests/lcitool/libvirt-ci @@ -1 +1 @@ -Subproject commit 77c800186f34b21be7660750577cc5582a914deb +Subproject commit cec67039719becbfbab866f9c23574f389cf9559 -- 2.44.0
[PATCH v3 11/13] block/nfs: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. While we're at it, slightly rephrase one of the error messages: Use "Invalid value..." instead of "Illegal value..." since the latter rather sounds like the users were breaking a law here. Reviewed-by: Eric Blake Signed-off-by: Thomas Huth --- block/nfs.c | 110 ++-- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index f737e19cd3..60240a8733 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -38,7 +38,6 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/replay.h" #include "qapi/qapi-visit-block-core.h" @@ -79,77 +78,76 @@ typedef struct NFSRPC { static int nfs_parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp = NULL; -int ret = -EINVAL, i; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +GUriParamsIter qp; +const char *uri_server, *uri_path, *uri_query; +char *qp_name, *qp_value; +GError *gerror = NULL; -uri = uri_parse(filename); if (!uri) { error_setg(errp, "Invalid URI specified"); -goto out; +return -EINVAL; } -if (g_strcmp0(uri->scheme, "nfs") != 0) { +if (!g_str_equal(g_uri_get_scheme(uri), "nfs")) { error_setg(errp, "URI scheme must be 'nfs'"); -goto out; +return -EINVAL; } -if (!uri->server) { +uri_server = g_uri_get_host(uri); +if (!uri_server || !uri_server[0]) { error_setg(errp, "missing hostname in URI"); -goto out; +return -EINVAL; } -if (!uri->path) { +uri_path = g_uri_get_path(uri); +if (!uri_path || !uri_path[0]) { error_setg(errp, "missing file path in URI"); -goto out; -} - -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto out; +return -EINVAL; } -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_server); qdict_put_str(options, "server.type", "inet"); -qdict_put_str(options, "path", uri->path); - -for (i = 0; i < qp->n; i++) { -uint64_t val; -if (!qp->p[i].value) { -error_setg(errp, "Value for NFS parameter expected: %s", - qp->p[i].name); -goto out; -} -if (parse_uint_full(qp->p[i].value, 0, &val)) { -error_setg(errp, "Illegal value for NFS parameter: %s", - qp->p[i].name); -goto out; -} -if (!strcmp(qp->p[i].name, "uid")) { -qdict_put_str(options, "user", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "gid")) { -qdict_put_str(options, "group", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "tcp-syncnt")) { -qdict_put_str(options, "tcp-syn-count", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "readahead")) { -qdict_put_str(options, "readahead-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "pagecache")) { -qdict_put_str(options, "page-cache-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "debug")) { -qdict_put_str(options, "debug", qp->p[i].value); -} else { -error_setg(errp, "Unknown NFS parameter name: %s", - qp->p[i].name); -goto out; +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +uint64_t val; +if (!qp_name || gerror) { +error_setg(errp, "Failed to parse NFS parameter"); +return -EINVAL; +} +if (!qp_value) { +error_setg(errp, "Value for NFS parameter expected: %s", + qp_name); +return -EINVAL; +} +if (parse_uint_full(qp_value, 0, &val)) { +error_setg(errp, "Inva
[PATCH v3 13/13] util/uri: Remove the old URI parsing code
Now that we switched all consumers of the URI code to use the URI parsing functions from glib instead, we can remove our internal URI parsing code since it is not used anymore. Reviewed-by: Eric Blake Signed-off-by: Thomas Huth --- include/qemu/uri.h | 99 --- util/uri.c | 1466 util/meson.build |2 +- 3 files changed, 1 insertion(+), 1566 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c diff --git a/include/qemu/uri.h b/include/qemu/uri.h deleted file mode 100644 index 255e61f452..00 --- a/include/qemu/uri.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Daniel Veillard shall not - * be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from him. - * - * Author: Daniel Veillard - ** - * Copyright (C) 2007 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <https://www.gnu.org/licenses/>. - * - * Authors: - *Richard W.M. Jones - * - * Utility functions to help parse and assemble query strings. - */ - -#ifndef QEMU_URI_H -#define QEMU_URI_H - -/** - * URI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - */ -typedef struct URI { -char *scheme; /* the URI scheme */ -char *opaque; /* opaque part */ -char *authority; /* the authority part */ -char *server; /* the server part */ -char *user;/* the user part */ -int port; /* the port number */ -char *path;/* the path string */ -char *fragment;/* the fragment identifier */ -int cleanup; /* parsing potentially unclean URI */ -char *query; /* the query string (as it appears in the URI) */ -} URI; - -URI *uri_new(void); -URI *uri_parse(const char *str); -URI *uri_parse_raw(const char *str, int raw); -int uri_parse_into(URI *uri, const char *str); -char *uri_to_string(URI *uri); -void uri_free(URI *uri); - -/* Single web service query parameter 'name=value'. */ -typedef struct QueryParam { - char *name; /* Name (unescaped). */ - char *value; /* Value (unescaped). */ - int ignore; /* Ignore this field in qparam_get_query */ -} QueryParam; - -/* Set of parameters. */ -typedef struct QueryParams { - int n; /* number of parameters used */ - int alloc; /* allocated space */ - QueryParam *p; /* array of parameters */ -} QueryParams; - -QueryParams *query_params_new(int init_alloc); -QueryParams *query_params_parse(const char *query); -void query_params_free(QueryParams *ps); - -#endif /* QEMU_URI_H */ diff --git a/util/uri.c b/util/uri.c deleted file mode 100644 index 573174bf47..00 --- a/util/uri.c +++ /dev/null @@ -1,1466 +0,0 @@ -/** - * uri.c: set of generic URI related routines - * - * Reference: RFCs 3986, 2732 and 2373 - * - * Copyright (C) 1998-2003 D
[PATCH v3 03/13] tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update
This update adds the removing of the EXTERNALLY-MANAGED marker files that has been added to the lcitool recently. Quoting Daniel: "For those who don't know, python now commonly blocks the ability to run 'pip install' outside of a venv. This generally makes sense for a precious installation environment. Our containers are disposable though, so a venv has no benefit. Removing the 'EXTERNALLY-MANAGED' allows the historical arbitrary use of 'pip' outside a venv. lcitool just does this unconditionally given the containers are not precious." Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/docker/dockerfiles/alpine.docker| 3 ++- tests/docker/dockerfiles/centos8.docker | 1 + tests/docker/dockerfiles/debian-amd64-cross.docker| 3 ++- tests/docker/dockerfiles/debian-arm64-cross.docker| 3 ++- tests/docker/dockerfiles/debian-armel-cross.docker| 3 ++- tests/docker/dockerfiles/debian-armhf-cross.docker| 3 ++- tests/docker/dockerfiles/debian-i686-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mips64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mipsel-cross.docker | 3 ++- tests/docker/dockerfiles/debian-ppc64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-riscv64-cross.docker | 3 ++- tests/docker/dockerfiles/debian-s390x-cross.docker| 3 ++- tests/docker/dockerfiles/debian.docker| 1 + tests/docker/dockerfiles/fedora-win64-cross.docker| 3 ++- tests/docker/dockerfiles/fedora.docker| 1 + tests/docker/dockerfiles/opensuse-leap.docker | 1 + tests/docker/dockerfiles/ubuntu2204.docker| 1 + 17 files changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker index 42f6928627..cd9d7af1ce 100644 --- a/tests/docker/dockerfiles/alpine.docker +++ b/tests/docker/dockerfiles/alpine.docker @@ -116,7 +116,8 @@ RUN apk update && \ zlib-static \ zstd \ zstd-dev && \ -apk list | sort > /packages.txt && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ +apk list --installed | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker index d97c30e96a..ea618bf352 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos8.docker @@ -123,6 +123,7 @@ RUN dnf distro-sync -y && \ zstd && \ dnf autoremove -y && \ dnf clean all -y && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ rpm -qa | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ diff --git a/tests/docker/dockerfiles/debian-amd64-cross.docker b/tests/docker/dockerfiles/debian-amd64-cross.docker index 00bdc06021..d0b0e9778e 100644 --- a/tests/docker/dockerfiles/debian-amd64-cross.docker +++ b/tests/docker/dockerfiles/debian-amd64-cross.docker @@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ -dpkg-reconfigure locales +dpkg-reconfigure locales && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker index 2dae3777f7..8cb225740e 100644 --- a/tests/docker/dockerfiles/debian-arm64-cross.docker +++ b/tests/docker/dockerfiles/debian-arm64-cross.docker @@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ -dpkg-reconfigure locales +dpkg-reconfigure locales && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/docker/dockerfiles/debian-armel-cross.docker index 75342c09b0..e6f37418ed 100644 --- a/tests/docker/dockerfiles/debian-armel-cross.docker +++ b/tests/docker/dockerfiles/debian-armel-cross.docker @@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y &&
[PATCH v3 05/13] .travis.yml: Update the jobs to Ubuntu 22.04
According to our support policy, we'll soon drop our official support for Ubuntu 20.04 ("Focal Fossa") in QEMU. Thus we should update the Travis jobs now to a newer release (Ubuntu 22.04 - "Jammy Jellyfish") for future testing. Since all jobs are using this release now, we can drop the entries from the individual jobs and use the global setting again. Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- .travis.yml | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a3ae76a7c..56a2a01e14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: linux -dist: focal +dist: jammy language: c compiler: - gcc @@ -7,7 +7,7 @@ cache: # There is one cache per branch and compiler version. # characteristics of each job are used to identify the cache: # - OS name (currently only linux) - # - OS distribution (for Linux, bionic or focal) + # - OS distribution (e.g. "jammy" for Linux) # - Names and values of visible environment variables set in .travis.yml or Settings panel timeout: 1200 ccache: true @@ -83,7 +83,6 @@ jobs: - name: "[aarch64] GCC check-tcg" arch: arm64 - dist: focal addons: apt_packages: - libaio-dev @@ -119,7 +118,6 @@ jobs: - name: "[ppc64] GCC check-tcg" arch: ppc64le - dist: focal addons: apt_packages: - libaio-dev @@ -154,7 +152,6 @@ jobs: - name: "[s390x] GCC check-tcg" arch: s390x - dist: focal addons: apt_packages: - libaio-dev @@ -199,7 +196,6 @@ jobs: - name: "[s390x] GCC (other-system)" arch: s390x - dist: focal addons: apt_packages: - libaio-dev @@ -229,7 +225,6 @@ jobs: - name: "[s390x] GCC (user)" arch: s390x - dist: focal addons: apt_packages: - libgcrypt20-dev @@ -244,8 +239,7 @@ jobs: - name: "[s390x] Clang (disable-tcg)" arch: s390x - dist: focal - compiler: clang-10 + compiler: clang addons: apt_packages: - libaio-dev @@ -271,7 +265,6 @@ jobs: - libvdeplug-dev - libvte-2.91-dev - ninja-build - - clang-10 env: - TEST_CMD="make check-unit" - CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools -- 2.44.0
[PATCH v3 07/13] Bump minimum glib version to v2.66
Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are: CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5:2.70.5 pkgsrc_current:2.78.4 Ubuntu 22.04: 2.72.1 Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches. Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- meson.build | 16 +--- include/glib-compat.h| 27 ++- qga/commands-posix-ssh.c | 4 ++-- 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index 91a0aa64c6..142bafab61 100644 --- a/meson.build +++ b/meson.build @@ -869,7 +869,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ # When bumping glib minimum version, please check also whether to increase # the _WIN32_WINNT setting in osdep.h according to the value from glib -glib_req_ver = '>=2.56.0' +glib_req_ver = '>=2.66.0' glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true, method: 'pkg-config') glib_cflags = [] @@ -910,20 +910,6 @@ if not cc.compiles(''' to the right pkg-config files for your build target.''') endif -# Silence clang warnings triggered by glib < 2.57.2 -if not cc.compiles(''' - #include - typedef struct Foo { -int i; - } Foo; - static void foo_free(Foo *f) - { -g_free(f); - } - G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free) - int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror']) - glib_cflags += cc.get_supported_arguments('-Wno-unused-function') -endif glib = declare_dependency(dependencies: [glib_pc, gmodule], compile_args: glib_cflags, version: glib_pc.version()) diff --git a/include/glib-compat.h b/include/glib-compat.h index 43a562974d..86be439ba0 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -19,12 +19,12 @@ /* Ask for warnings for anything that was marked deprecated in * the defined version, or before. It is a candidate for rewrite. */ -#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56 +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66 /* Ask for warnings if code tries to use function that did not * exist in the defined version. These risk breaking builds */ -#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56 +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) } #define g_memdup2(m, s) g_memdup2_qemu(m, s) -#if defined(G_OS_UNIX) -/* - * Note: The fallback implementation is not MT-safe, and it returns a copy of - * the libc passwd (must be g_free() after use) but not the content. Because of - * these important differences the caller must be aware of, it's not #define for - * GLib API substitution. - */ -static inline struct passwd * -g_unix_get_passwd_entry_qemu(const gchar *user_name, GError **error) -{ -#if GLIB_CHECK_VERSION(2, 64, 0) -return g_unix_get_passwd_entry(user_name, error); -#else -struct passwd *p = getpwnam(user_name); -if (!p) { -g_set_error_literal(error, G_UNIX_ERROR, 0, g_strerror(errno)); -return NULL; -} -return (struct passwd *)g_memdup(p, sizeof(*p)); -#endif -} -#endif /* G_OS_UNIX */ - static inline bool qemu_g_test_slow(void) { diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index 236f80de44..b0e0b1d674 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -35,7 +35,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error) return p; } -#define g_unix_get_passwd_entry_qemu(username, err) \ +#define g_unix_get_passwd_entry(username, err) \ test_get_passwd_entry(username, err) #endif @@ -45,7 +45,7 @@ get_passwd_entry(const char *username, Error **errp) g_autoptr(GError) err = NULL; struct passwd *p; -p = g_unix_get_passwd_entry_qemu(username, &err); +p = g_unix_get_passwd_entry(username, &err); if (p == NULL) { error_setg(errp, "failed to lookup user '%s': %s", username, err->message); -- 2.44.0
[PATCH v3 09/13] block/gluster: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Since g_uri_get_path() returns a const pointer, we also need to tweak the parameter of parse_volume_options() (where we use the result of g_uri_get_path() as input). Reviewed-by: Eric Blake Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- block/gluster.c | 71 - 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index cc74af06dc..1c9505f8bb 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -17,7 +17,6 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h" @@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs) } } -static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) +static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path) { -char *p, *q; +const char *p, *q; if (!path) { return -EINVAL; @@ -349,13 +348,13 @@ static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, const char *filename) { +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +g_autoptr(GHashTable) qp = NULL; SocketAddress *gsconf; -URI *uri; -QueryParams *qp = NULL; bool is_unix = false; -int ret = 0; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port, ret; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } @@ -364,57 +363,57 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, QAPI_LIST_PREPEND(gconf->server, gsconf); /* transport */ -if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { +uri_scheme = g_uri_get_scheme(uri); +if (!uri_scheme || !strcmp(uri_scheme, "gluster")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+tcp")) { +} else if (!strcmp(uri_scheme, "gluster+tcp")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+unix")) { +} else if (!strcmp(uri_scheme, "gluster+unix")) { gsconf->type = SOCKET_ADDRESS_TYPE_UNIX; is_unix = true; -} else if (!strcmp(uri->scheme, "gluster+rdma")) { +} else if (!strcmp(uri_scheme, "gluster+rdma")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; warn_report("rdma feature is not supported, falling back to tcp"); } else { -ret = -EINVAL; -goto out; +return -EINVAL; } -ret = parse_volume_options(gconf, uri->path); +ret = parse_volume_options(gconf, g_uri_get_path(uri)); if (ret < 0) { -goto out; +return ret; } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +return -EINVAL; +} +ret = g_hash_table_size(qp); +if (ret > 1 || (is_unix && !ret) || (!is_unix && ret)) { +return -EINVAL; +} } +uri_server = g_uri_get_host(uri); +uri_port = g_uri_get_port(uri); + if (is_unix) { -if (uri->server || uri->port) { -ret = -EINVAL; -goto out; -} -if (strcmp(qp->p[0].name, "socket")) { -ret = -EINVAL; -goto out; +char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { +return -EINVAL; } -gsconf->u.q_unix.path = g_strdup(qp->p[0].value); +gsconf->u.q_unix.path = g_strdup(uri_socket); } else { -gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost"); -if (uri->port) { -gsconf->u.inet.port = g_strdup_printf("%d", uri->port); +gsconf->u.inet.host = g_strdup(uri_server ? uri_server : "localhost"); +if (uri_port > 0) { +gsconf->u.inet.port = g_strdup_printf("%d", uri_port); } else { gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT); } } -out: -if (qp) { -query_params_free(qp); -} -uri_free(uri); -return ret; +return 0; } static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, -- 2.44.0
[PATCH v3 01/13] tests: Remove Ubuntu 20.04 container
Since Ubuntu 22.04 is now available since two years, we can stop actively supporting the previous LTS version of Ubuntu now. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- tests/docker/dockerfiles/ubuntu2004.docker | 157 - tests/lcitool/refresh | 1 - 2 files changed, 158 deletions(-) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker deleted file mode 100644 index d3e212060c..00 --- a/tests/docker/dockerfiles/ubuntu2004.docker +++ /dev/null @@ -1,157 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool dockerfile --layers all ubuntu-2004 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -FROM docker.io/library/ubuntu:20.04 - -RUN export DEBIAN_FRONTEND=noninteractive && \ -apt-get update && \ -apt-get install -y eatmydata && \ -eatmydata apt-get dist-upgrade -y && \ -eatmydata apt-get install --no-install-recommends -y \ - bash \ - bc \ - bison \ - bsdmainutils \ - bzip2 \ - ca-certificates \ - ccache \ - clang \ - dbus \ - debianutils \ - diffutils \ - exuberant-ctags \ - findutils \ - flex \ - g++ \ - gcc \ - gcovr \ - gettext \ - git \ - hostname \ - libaio-dev \ - libasan6 \ - libasound2-dev \ - libattr1-dev \ - libbrlapi-dev \ - libbz2-dev \ - libc6-dev \ - libcacard-dev \ - libcap-ng-dev \ - libcapstone-dev \ - libcmocka-dev \ - libcurl4-gnutls-dev \ - libdaxctl-dev \ - libdrm-dev \ - libepoxy-dev \ - libfdt-dev \ - libffi-dev \ - libfuse3-dev \ - libgbm-dev \ - libgcrypt20-dev \ - libglib2.0-dev \ - libglusterfs-dev \ - libgnutls28-dev \ - libgtk-3-dev \ - libibumad-dev \ - libibverbs-dev \ - libiscsi-dev \ - libjemalloc-dev \ - libjpeg-turbo8-dev \ - libjson-c-dev \ - liblttng-ust-dev \ - liblzo2-dev \ - libncursesw5-dev \ - libnfs-dev \ - libnuma-dev \ - libpam0g-dev \ - libpcre2-dev \ - libpixman-1-dev \ - libpmem-dev \ - libpng-dev \ - libpulse-dev \ - librbd-dev \ - librdmacm-dev \ - libsasl2-dev \ - libsdl2-dev \ - libsdl2-image-dev \ - libseccomp-dev \ - libselinux1-dev \ - libslirp-dev \ - libsnappy-dev \ - libsndio-dev \ - libspice-protocol-dev \ - libspice-server-dev \ - libssh-dev \ - libsystemd-dev \ - libtasn1-6-dev \ - libubsan1 \ - libudev-dev \ - libusb-1.0-0-dev \ - libusbredirhost-dev \ - libvdeplug-dev \ - libvirglrenderer-dev \ - libvte-2.91-dev \ - libxen-dev \ - libzstd-dev \ - llvm \ - locales \ - make \ - mtools \ - multipath-tools \ - ncat \ - nettle-dev \ - ninja-build \ - openssh-client \ - pkgconf \ - python3 \ - python3-numpy \ - python3-opencv \ - python3-pillow \ - python3-pip \ - python3-setuptools \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ -
[PATCH v3 00/13] Drop old distros, bump glib and switch to glib URI parsing code
In the QEMU 9.1 development cycle, we can drop the support for Ubuntu 20.04 and CentOS 8 since the following major versions of these distributions are available since 2 years already. This allows us to bump the minimum version of glib to 2.66 which comes with a nice set of URI parsing functions. By switching to these parsing functions, we can finally drop our own URI parsing code in util/uri.c. NB: We also need to update some of the custom runners in our CI environment first (since they still use Ubuntu 20.04). v3: - Added Reviewed-bys - Updated many patch descriptions according to the review feedback in v2 - Change "Illegal" in warning message to "Invalid" - Removed "." at the end of a warn_report string v2: - Added Paolo's patch to bump the external CI runners - Added patch to drop more glib compatibility hunks - Use g_autoptr() in the URI patches for simplification - Don't allow port 0 in the URIs Paolo Bonzini (1): ci: move external build environment setups to CentOS Stream 9 Thomas Huth (12): tests: Remove Ubuntu 20.04 container tests/lcitool/libvirt-ci: Update to the latest master branch tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update tests: Update our CI to use CentOS Stream 9 instead of 8 .travis.yml: Update the jobs to Ubuntu 22.04 Bump minimum glib version to v2.66 Remove glib compatibility code that is not required anymore block/gluster: Use URI parsing code from glib block/nbd: Use URI parsing code from glib block/nfs: Use URI parsing code from glib block/ssh: Use URI parsing code from glib util/uri: Remove the old URI parsing code meson.build | 16 +- include/glib-compat.h | 27 +- include/qemu/uri.h| 99 -- block/gluster.c | 71 +- block/nbd.c | 76 +- block/nfs.c | 110 +- block/ssh.c | 75 +- qga/commands-posix-ssh.c | 12 +- util/error-report.c | 10 - util/uri.c| 1466 - .gitlab-ci.d/buildtest.yml| 16 +- .gitlab-ci.d/container-core.yml |4 +- .travis.yml | 13 +- .../stream/{8 => 9}/build-environment.yml | 31 +- .../stream/{8 => 9}/x86_64/configure |4 +- .../stream/{8 => 9}/x86_64/test-avocado |0 scripts/ci/setup/build-environment.yml| 44 +- tests/docker/dockerfiles/alpine.docker|3 +- .../{centos8.docker => centos9.docker}| 35 +- .../dockerfiles/debian-amd64-cross.docker |3 +- .../dockerfiles/debian-arm64-cross.docker |3 +- .../dockerfiles/debian-armel-cross.docker |3 +- .../dockerfiles/debian-armhf-cross.docker |3 +- .../dockerfiles/debian-i686-cross.docker |3 +- .../dockerfiles/debian-mips64el-cross.docker |3 +- .../dockerfiles/debian-mipsel-cross.docker|3 +- .../dockerfiles/debian-ppc64el-cross.docker |3 +- .../dockerfiles/debian-riscv64-cross.docker |3 +- .../dockerfiles/debian-s390x-cross.docker |3 +- tests/docker/dockerfiles/debian.docker|1 + .../dockerfiles/fedora-win64-cross.docker |3 +- tests/docker/dockerfiles/fedora.docker|1 + tests/docker/dockerfiles/opensuse-leap.docker |1 + tests/docker/dockerfiles/ubuntu2004.docker| 157 -- tests/docker/dockerfiles/ubuntu2204.docker|1 + tests/lcitool/libvirt-ci |2 +- tests/lcitool/mappings.yml| 20 - tests/lcitool/refresh |3 +- tests/vm/centos |4 +- util/meson.build |2 +- 40 files changed, 265 insertions(+), 2072 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%) rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker -- 2.44.0
Re: [PATCH v2 04/13] tests: Update our CI to use CentOS Stream 9 instead of 8
On 17/04/2024 18.15, Daniel P. Berrangé wrote: On Fri, Apr 12, 2024 at 03:24:06PM +0200, Thomas Huth wrote: RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Thus upgrade our CentOS Stream container to major version 9 now. The second reason for doing this is that Centos Stream 8 will go EOL in about 1 month: https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/ "After May 31, 2024, CentOS Stream 8 will be archived and no further updates will be provided." I'm seeking confirmation, but I suspect after that date we will be unable to build centos8 containers, as the package repos will likely be archived. RHEL-8 and other derivatives (Alma Linux, Rocky Linux, etc) remain actively supported by their respective vendors / communities. Only CentOS Stream EOLs. This has implications for our CI on stable branches. It is valid for our stable branches to continue targetting the RHEL-8 family of distros, as a 2 year cutoff in our support policy is evaluated at time of each given major release. IOW, cherry-picking this change to switch to CentOS Stream 9 is possibly inappropriate for stable branches. lcitool supports Alma Linux as target, so we could switch stable branches to Alma Linux 8 if desired to keep CI coverage of RHEL-8 family. Thoughts ? Either use AlmaLinux for the stable branches, or drop the EL 8 testing in the stable CI completely ... I assume that the probability will be rather low that we break something there by backporting some few patches (and if so, people can still complain by opening a bug ticket, then we can fix it in the following stable release). Thomas
Re: [PATCH v2 09/13] block/gluster: Use URI parsing code from glib
On 12/04/2024 16.40, Eric Blake wrote: On Fri, Apr 12, 2024 at 03:24:11PM +0200, Thomas Huth wrote: Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Signed-off-by: Thomas Huth --- block/gluster.c | 71 - 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index cc74af06dc..1c9505f8bb 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -17,7 +17,6 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h" @@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs) } } -static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) +static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path) Is it worth mentioning in the commit message that this includes a const-correctness tweak? I can add something like: "Since g_uri_get_path() returns a const pointer, we also need to tweak the parameter of parse_volume_options() (where we use the result of g_uri_get_path() as input)" @@ -364,57 +363,57 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, QAPI_LIST_PREPEND(gconf->server, gsconf); /* transport */ -if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { +uri_scheme = g_uri_get_scheme(uri); +if (!uri_scheme || !strcmp(uri_scheme, "gluster")) { Pre-existing, but per RFC 3986, we should probably be using strcasecmp for scheme comparisons (I'm not sure if g_uri_parse guarantees a lower-case return, even when the user passed in upper case). That can be a separate patch. As Daniel mentioned, g_uri_get_scheme() returns a lowercase string, so we should be fine. Reviewed-by: Eric Blake Thanks! Thomas
[PATCH v2 12/13] block/ssh: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Reviewed-by: Richard W.M. Jones Signed-off-by: Thomas Huth --- block/ssh.c | 75 - 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/block/ssh.c b/block/ssh.c index 2748253d4a..18ae565e55 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -37,7 +37,6 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" -#include "qemu/uri.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" @@ -181,65 +180,71 @@ static void sftp_error_trace(BDRVSSHState *s, const char *op) static int parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +const char *uri_host, *uri_path, *uri_user, *uri_query; char *port_str; -int i; +int port; +g_autoptr(GError) gerror = NULL; +char *qp_name, *qp_value; +GUriParamsIter qp; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } -if (g_strcmp0(uri->scheme, "ssh") != 0) { +if (g_strcmp0(g_uri_get_scheme(uri), "ssh") != 0) { error_setg(errp, "URI scheme must be 'ssh'"); -goto err; +return -EINVAL; } -if (!uri->server || strcmp(uri->server, "") == 0) { +uri_host = g_uri_get_host(uri); +if (!uri_host || g_str_equal(uri_host, "")) { error_setg(errp, "missing hostname in URI"); -goto err; +return -EINVAL; } -if (!uri->path || strcmp(uri->path, "") == 0) { +uri_path = g_uri_get_path(uri); +if (!uri_path || g_str_equal(uri_path, "")) { error_setg(errp, "missing remote path in URI"); -goto err; -} - -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto err; +return -EINVAL; } -if(uri->user && strcmp(uri->user, "") != 0) { -qdict_put_str(options, "user", uri->user); +uri_user = g_uri_get_user(uri); +if (uri_user && !g_str_equal(uri_user, "")) { +qdict_put_str(options, "user", uri_user); } -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_host); -port_str = g_strdup_printf("%d", uri->port ?: 22); +port = g_uri_get_port(uri); +port_str = g_strdup_printf("%d", port > 0 ? port : 22); qdict_put_str(options, "server.port", port_str); g_free(port_str); -qdict_put_str(options, "path", uri->path); - -/* Pick out any query parameters that we understand, and ignore - * the rest. - */ -for (i = 0; i < qp->n; ++i) { -if (strcmp(qp->p[i].name, "host_key_check") == 0) { -qdict_put_str(options, "host_key_check", qp->p[i].value); +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +if (!qp_name || !qp_value || gerror) { +warn_report("Failed to parse SSH URI parameters '%s'.", +uri_query); +break; +} +/* + * Pick out the query parameters that we understand, and ignore + * (or rather warn about) the rest. + */ +if (g_str_equal(qp_name, "host_key_check")) { +qdict_put_str(options, "host_key_check", qp_value); +} else { +warn_report("Unsupported parameter '%s' in URI.", qp_name); +} } } -query_params_free(qp); -uri_free(uri); return 0; - - err: -uri_free(uri); -return -EINVAL; } static bool ssh_has_filename_options_conflict(QDict *options, Error **errp) -- 2.44.0
[PATCH v2 10/13] block/nbd: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too. Reviewed-by: Richard W.M. Jones Signed-off-by: Thomas Huth --- block/nbd.c | 76 ++--- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index ef05f7cdfd..589d28af83 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "trace.h" -#include "qemu/uri.h" #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" @@ -1514,30 +1513,31 @@ static void nbd_client_close(BlockDriverState *bs) static int nbd_parse_uri(const char *filename, QDict *options) { -URI *uri; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +g_autoptr(GHashTable) qp = NULL; const char *p; -QueryParams *qp = NULL; -int ret = 0; +int qp_n; bool is_unix; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } /* transport */ -if (!g_strcmp0(uri->scheme, "nbd")) { +uri_scheme = g_uri_get_scheme(uri); +if (!g_strcmp0(uri_scheme, "nbd")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+tcp")) { +} else if (!g_strcmp0(uri_scheme, "nbd+tcp")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+unix")) { +} else if (!g_strcmp0(uri_scheme, "nbd+unix")) { is_unix = true; } else { -ret = -EINVAL; -goto out; +return -EINVAL; } -p = uri->path ? uri->path : ""; +p = g_uri_get_path(uri) ?: ""; if (p[0] == '/') { p++; } @@ -1545,52 +1545,50 @@ static int nbd_parse_uri(const char *filename, QDict *options) qdict_put_str(options, "export", p); } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +return -EINVAL; +} +qp_n = g_hash_table_size(qp); +if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) { +return -EINVAL; +} + } + +uri_server = g_uri_get_host(uri); +if (uri_server && !uri_server[0]) { +uri_server = NULL; } +uri_port = g_uri_get_port(uri); if (is_unix) { /* nbd+unix:///export?socket=path */ -if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) { -ret = -EINVAL; -goto out; +const char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { +return -EINVAL; } qdict_put_str(options, "server.type", "unix"); -qdict_put_str(options, "server.path", qp->p[0].value); +qdict_put_str(options, "server.path", uri_socket); } else { -QString *host; char *port_str; /* nbd[+tcp]://host[:port]/export */ -if (!uri->server) { -ret = -EINVAL; -goto out; -} - -/* strip braces from literal IPv6 address */ -if (uri->server[0] == '[') { -host = qstring_from_substr(uri->server, 1, - strlen(uri->server) - 1); -} else { -host = qstring_from_str(uri->server); +if (!uri_server) { +return -EINVAL; } qdict_put_str(options, "server.type", "inet"); -qdict_put(options, "server.host", host); +qdict_put_str(options, "server.host", uri_server); -port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); +port_str = g_strdup_printf("%d", uri_port > 0 ? uri_port + : NBD_DEFAULT_PORT); qdict_put_str(options, "server.port", port_str); g_free(port_str); } -out: -if (qp) { -query_params_free(qp); -} -uri_free(uri); -return ret; +return 0; } static bool nbd_has_filename_options_conflict(QDict *options, Error **errp) -- 2.44.0
[PATCH v2 08/13] Remove glib compatibility code that is not required anymore
Now that we bumped the minumum glib version to 2.66, we can drop the old code. Suggested-by: Paolo Bonzini Signed-off-by: Thomas Huth --- qga/commands-posix-ssh.c | 8 util/error-report.c | 10 -- 2 files changed, 18 deletions(-) diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index b0e0b1d674..cc1f5a708e 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -288,7 +288,6 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp) } #ifdef QGA_BUILD_UNIT_TEST -#if GLIB_CHECK_VERSION(2, 60, 0) static const strList test_key2 = { .value = (char *)"algo key2 comments" }; @@ -484,11 +483,4 @@ int main(int argc, char *argv[]) return g_test_run(); } -#else -int main(int argc, char *argv[]) -{ -g_test_message("test skipped, needs glib >= 2.60"); -return 0; -} -#endif /* GLIB_2_60 */ #endif /* BUILD_UNIT_TEST */ diff --git a/util/error-report.c b/util/error-report.c index 6e44a55732..1b17c11de1 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -172,18 +172,8 @@ static void print_loc(void) static char * real_time_iso8601(void) { -#if GLIB_CHECK_VERSION(2,62,0) g_autoptr(GDateTime) dt = g_date_time_new_now_utc(); -/* ignore deprecation warning, since GLIB_VERSION_MAX_ALLOWED is 2.56 */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" return g_date_time_format_iso8601(dt); -#pragma GCC diagnostic pop -#else -GTimeVal tv; -g_get_current_time(&tv); -return g_time_val_to_iso8601(&tv); -#endif } /* -- 2.44.0
[PATCH v2 06/13] ci: move external build environment setups to CentOS Stream 9
From: Paolo Bonzini RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Thus upgrade our CentOS Stream build environment playbooks to major version 9 now. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240412103708.27650-1-pbonz...@redhat.com> Signed-off-by: Thomas Huth --- .../stream/{8 => 9}/build-environment.yml | 31 ++--- .../stream/{8 => 9}/x86_64/configure | 4 +- .../stream/{8 => 9}/x86_64/test-avocado | 0 scripts/ci/setup/build-environment.yml| 44 +++ 4 files changed, 34 insertions(+), 45 deletions(-) rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%) diff --git a/scripts/ci/org.centos/stream/8/build-environment.yml b/scripts/ci/org.centos/stream/9/build-environment.yml similarity index 75% rename from scripts/ci/org.centos/stream/8/build-environment.yml rename to scripts/ci/org.centos/stream/9/build-environment.yml index 1ead77e2cb..cd29fe6f27 100644 --- a/scripts/ci/org.centos/stream/8/build-environment.yml +++ b/scripts/ci/org.centos/stream/9/build-environment.yml @@ -2,32 +2,32 @@ - name: Installation of extra packages to build QEMU hosts: all tasks: -- name: Extra check for CentOS Stream 8 +- name: Extra check for CentOS Stream 9 lineinfile: path: /etc/redhat-release -line: CentOS Stream release 8 +line: CentOS Stream release 9 state: present check_mode: yes - register: centos_stream_8 + register: centos_stream_9 -- name: Enable EPEL repo on CentOS Stream 8 +- name: Enable EPEL repo on CentOS Stream 9 dnf: name: - epel-release state: present when: -- centos_stream_8 +- centos_stream_9 -- name: Enable PowerTools repo on CentOS Stream 8 +- name: Enable CRB repo on CentOS Stream 9 ini_file: -path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo -section: powertools +path: /etc/yum.repos.d/centos.repo +section: crb option: enabled value: "1" when: -- centos_stream_8 +- centos_stream_9 -- name: Install basic packages to build QEMU on CentOS Stream 8 +- name: Install basic packages to build QEMU on CentOS Stream 9 dnf: name: - bzip2 @@ -42,7 +42,6 @@ - gettext - git - glib2-devel - - glusterfs-api-devel - gnutls-devel - libaio-devel - libcap-ng-devel @@ -61,22 +60,24 @@ - lzo-devel - make - mesa-libEGL-devel + - meson - nettle-devel - ninja-build - nmap-ncat - numactl-devel - pixman-devel - - python38 + - python3 + - python3-pip - python3-sphinx + - python3-sphinx_rtd_theme + - python3-tomli - rdma-core-devel - redhat-rpm-config - snappy-devel - - spice-glib-devel - - spice-server-devel - systemd-devel - systemtap-sdt-devel - tar - zlib-devel state: present when: -- centos_stream_8 +- centos_stream_9 diff --git a/scripts/ci/org.centos/stream/8/x86_64/configure b/scripts/ci/org.centos/stream/9/x86_64/configure similarity index 98% rename from scripts/ci/org.centos/stream/8/x86_64/configure rename to scripts/ci/org.centos/stream/9/x86_64/configure index 76781f17f4..1b6f40fd78 100755 --- a/scripts/ci/org.centos/stream/8/x86_64/configure +++ b/scripts/ci/org.centos/stream/9/x86_64/configure @@ -16,7 +16,7 @@ # that patches adding downstream specific devices are not available. # ../configure \ ---python=/usr/bin/python3.8 \ +--python=/usr/bin/python3.9 \ --prefix="/usr" \ --libdir="/usr/lib64" \ --datadir="/usr/share" \ @@ -157,7 +157,6 @@ --enable-docs \ --enable-fdt \ --enable-gcrypt \ ---enable-glusterfs \ --enable-gnutls \ --enable-guest-agent \ --enable-iconv \ @@ -180,7 +179,6 @@ --enable-seccomp \ --enable-snappy \ --enable-smartcard \ ---enable-spice \ --enable-system \ --enable-tcg \ --enable-tools \ diff --git a/scripts/ci/org.centos/stream/8/x86_64/test-avocado b/scripts/ci/org.centos/stream/9/x86_64/test-avocado similarity index 100% rename from scripts/ci/org.centos/stream/8/x86_64/test-avocado rename to scripts/ci/org.centos/stream/9/x86_64/test-avocado diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml index f344d1a850..9b7d96c01b 100644 --- a/scripts/ci/setup/build-en
[PATCH v2 11/13] block/nfs: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Signed-off-by: Thomas Huth --- block/nfs.c | 110 ++-- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index f737e19cd3..07f50b7402 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -38,7 +38,6 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/replay.h" #include "qapi/qapi-visit-block-core.h" @@ -79,77 +78,76 @@ typedef struct NFSRPC { static int nfs_parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp = NULL; -int ret = -EINVAL, i; +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +GUriParamsIter qp; +const char *uri_server, *uri_path, *uri_query; +char *qp_name, *qp_value; +GError *gerror = NULL; -uri = uri_parse(filename); if (!uri) { error_setg(errp, "Invalid URI specified"); -goto out; +return -EINVAL; } -if (g_strcmp0(uri->scheme, "nfs") != 0) { +if (!g_str_equal(g_uri_get_scheme(uri), "nfs")) { error_setg(errp, "URI scheme must be 'nfs'"); -goto out; +return -EINVAL; } -if (!uri->server) { +uri_server = g_uri_get_host(uri); +if (!uri_server || !uri_server[0]) { error_setg(errp, "missing hostname in URI"); -goto out; +return -EINVAL; } -if (!uri->path) { +uri_path = g_uri_get_path(uri); +if (!uri_path || !uri_path[0]) { error_setg(errp, "missing file path in URI"); -goto out; -} - -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto out; +return -EINVAL; } -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_server); qdict_put_str(options, "server.type", "inet"); -qdict_put_str(options, "path", uri->path); - -for (i = 0; i < qp->n; i++) { -uint64_t val; -if (!qp->p[i].value) { -error_setg(errp, "Value for NFS parameter expected: %s", - qp->p[i].name); -goto out; -} -if (parse_uint_full(qp->p[i].value, 0, &val)) { -error_setg(errp, "Illegal value for NFS parameter: %s", - qp->p[i].name); -goto out; -} -if (!strcmp(qp->p[i].name, "uid")) { -qdict_put_str(options, "user", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "gid")) { -qdict_put_str(options, "group", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "tcp-syncnt")) { -qdict_put_str(options, "tcp-syn-count", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "readahead")) { -qdict_put_str(options, "readahead-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "pagecache")) { -qdict_put_str(options, "page-cache-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "debug")) { -qdict_put_str(options, "debug", qp->p[i].value); -} else { -error_setg(errp, "Unknown NFS parameter name: %s", - qp->p[i].name); -goto out; +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +uint64_t val; +if (!qp_name || gerror) { +error_setg(errp, "Failed to parse NFS parameter"); +return -EINVAL; +} +if (!qp_value) { +error_setg(errp, "Value for NFS parameter expected: %s", + qp_name); +return -EINVAL; +} +if (parse_uint_full(qp_value, 0, &val)) { +error_setg(errp, "Illegal value for NFS parameter: %s", + qp_name); +return -EINVAL; +} +if (g_str_equal(qp_name, "uid")) { +qdict_put_str(options, "user", qp_value); +
[PATCH v2 05/13] .travis.yml: Update the jobs to Ubuntu 22.04
According to our support policy, we'll soon drop our official support for Ubuntu 20.04 ("Focal Fossa") in QEMU. Thus we should update the Travis jobs now to a newer release (Ubuntu 22.04 - "Jammy Jellyfish") for future testing. Since all jobs are using this release now, we can drop the entries from the individual jobs and use the global setting again. Signed-off-by: Thomas Huth --- .travis.yml | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a3ae76a7c..56a2a01e14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ os: linux -dist: focal +dist: jammy language: c compiler: - gcc @@ -7,7 +7,7 @@ cache: # There is one cache per branch and compiler version. # characteristics of each job are used to identify the cache: # - OS name (currently only linux) - # - OS distribution (for Linux, bionic or focal) + # - OS distribution (e.g. "jammy" for Linux) # - Names and values of visible environment variables set in .travis.yml or Settings panel timeout: 1200 ccache: true @@ -83,7 +83,6 @@ jobs: - name: "[aarch64] GCC check-tcg" arch: arm64 - dist: focal addons: apt_packages: - libaio-dev @@ -119,7 +118,6 @@ jobs: - name: "[ppc64] GCC check-tcg" arch: ppc64le - dist: focal addons: apt_packages: - libaio-dev @@ -154,7 +152,6 @@ jobs: - name: "[s390x] GCC check-tcg" arch: s390x - dist: focal addons: apt_packages: - libaio-dev @@ -199,7 +196,6 @@ jobs: - name: "[s390x] GCC (other-system)" arch: s390x - dist: focal addons: apt_packages: - libaio-dev @@ -229,7 +225,6 @@ jobs: - name: "[s390x] GCC (user)" arch: s390x - dist: focal addons: apt_packages: - libgcrypt20-dev @@ -244,8 +239,7 @@ jobs: - name: "[s390x] Clang (disable-tcg)" arch: s390x - dist: focal - compiler: clang-10 + compiler: clang addons: apt_packages: - libaio-dev @@ -271,7 +265,6 @@ jobs: - libvdeplug-dev - libvte-2.91-dev - ninja-build - - clang-10 env: - TEST_CMD="make check-unit" - CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools -- 2.44.0
[PATCH v2 13/13] util/uri: Remove the old URI parsing code
Now that we switched all consumers of the URI code to use the URI parsing functions from glib instead, we can remove our internal URI parsing code since it is not used anymore. Signed-off-by: Thomas Huth --- include/qemu/uri.h | 99 --- util/uri.c | 1466 util/meson.build |2 +- 3 files changed, 1 insertion(+), 1566 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c diff --git a/include/qemu/uri.h b/include/qemu/uri.h deleted file mode 100644 index 255e61f452..00 --- a/include/qemu/uri.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Daniel Veillard shall not - * be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from him. - * - * Author: Daniel Veillard - ** - * Copyright (C) 2007 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <https://www.gnu.org/licenses/>. - * - * Authors: - *Richard W.M. Jones - * - * Utility functions to help parse and assemble query strings. - */ - -#ifndef QEMU_URI_H -#define QEMU_URI_H - -/** - * URI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - */ -typedef struct URI { -char *scheme; /* the URI scheme */ -char *opaque; /* opaque part */ -char *authority; /* the authority part */ -char *server; /* the server part */ -char *user;/* the user part */ -int port; /* the port number */ -char *path;/* the path string */ -char *fragment;/* the fragment identifier */ -int cleanup; /* parsing potentially unclean URI */ -char *query; /* the query string (as it appears in the URI) */ -} URI; - -URI *uri_new(void); -URI *uri_parse(const char *str); -URI *uri_parse_raw(const char *str, int raw); -int uri_parse_into(URI *uri, const char *str); -char *uri_to_string(URI *uri); -void uri_free(URI *uri); - -/* Single web service query parameter 'name=value'. */ -typedef struct QueryParam { - char *name; /* Name (unescaped). */ - char *value; /* Value (unescaped). */ - int ignore; /* Ignore this field in qparam_get_query */ -} QueryParam; - -/* Set of parameters. */ -typedef struct QueryParams { - int n; /* number of parameters used */ - int alloc; /* allocated space */ - QueryParam *p; /* array of parameters */ -} QueryParams; - -QueryParams *query_params_new(int init_alloc); -QueryParams *query_params_parse(const char *query); -void query_params_free(QueryParams *ps); - -#endif /* QEMU_URI_H */ diff --git a/util/uri.c b/util/uri.c deleted file mode 100644 index 573174bf47..00 --- a/util/uri.c +++ /dev/null @@ -1,1466 +0,0 @@ -/** - * uri.c: set of generic URI related routines - * - * Reference: RFCs 3986, 2732 and 2373 - * - * Copyright (C) 1998-2003 Daniel Veillard. All Rights Re
[PATCH v2 04/13] tests: Update our CI to use CentOS Stream 9 instead of 8
RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Thus upgrade our CentOS Stream container to major version 9 now. Signed-off-by: Thomas Huth --- .gitlab-ci.d/buildtest.yml| 16 - .gitlab-ci.d/container-core.yml | 4 +-- .../{centos8.docker => centos9.docker}| 34 +++ tests/lcitool/mappings.yml| 20 --- tests/lcitool/refresh | 2 +- tests/vm/centos | 4 +-- 6 files changed, 26 insertions(+), 54 deletions(-) rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index cfdff175c3..9f34c650d6 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -158,9 +158,9 @@ build-system-centos: - .native_build_job_template - .native_build_artifact_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server --enable-modules --enable-trace-backends=dtrace --enable-docs TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu @@ -242,7 +242,7 @@ check-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check avocado-system-centos: @@ -251,7 +251,7 @@ avocado-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check-avocado AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 arch:nios2 @@ -327,9 +327,9 @@ avocado-system-flaky: build-tcg-disabled: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 script: - mkdir build - cd build @@ -651,9 +651,9 @@ build-tci: build-without-defaults: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --without-default-devices --without-default-features diff --git a/.gitlab-ci.d/container-core.yml b/.gitlab-ci.d/container-core.yml index 08f8450fa1..5459447676 100644 --- a/.gitlab-ci.d/container-core.yml +++ b/.gitlab-ci.d/container-core.yml @@ -1,10 +1,10 @@ include: - local: '/.gitlab-ci.d/container-template.yml' -amd64-centos8-container: +amd64-centos9-container: extends: .container_job_template variables: -NAME: centos8 +NAME: centos9 amd64-fedora-container: extends: .container_job_template diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos9.docker similarity index 82% rename from tests/docker/dockerfiles/centos8.docker rename to tests/docker/dockerfiles/centos9.docker index ea618bf352..6cf47ce786 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos9.docker @@ -1,15 +1,14 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all centos-stream-8 qemu +# $ lcitool dockerfile --layers all centos-stream-9 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM quay.io/centos/centos:stream8 +FROM quay.io/centos/centos:stream9 RUN dnf distro-sync -y && \ dnf install 'dnf-command(config-manager)' -y && \ -dnf config-manager --set-enabled -y powertools && \ -dnf install -y centos-release-advanced-virtualization && \ +dnf config-manager --set-enabled -y crb && \ dnf install -y epel-release && \ dnf install -y epel-next-release && \ dnf install -y \ @@ -42,7 +41,6 @@ RUN dnf distro-sync -y && \ glib2-static \ glibc-langpack-en \ glibc-static \ -glusterfs-api-devel \ gnutls-devel \ gtk3-devel \ hostname \ @@ -82,6 +80,7 @@ RUN dnf distro-sync -y && \ lzo-devel \ make \ mesa-libgbm-devel \ +meson \ mtools \ ncurses-devel \ nettle-devel \ @@ -95,25 +94,25 @@ RUN dnf distro-sync -y && \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \ -python38 \ -python38-PyYAML \ -python38-numpy \ -python38-pip \ -python38-setuptools \ -python38-wheel \ +python3 \ +python3-PyYAML \ +python3-numpy \ +python3-pillow \ +python3-pip \ +python3-sphinx \ +python3-sphinx_rtd_theme \ +python3-tomli \ rdma-core-devel
[PATCH v2 03/13] tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update
This update adds the removing of the EXTERNALLY-MANAGED marker files that has been added to the lcitool recently. Signed-off-by: Thomas Huth --- tests/docker/dockerfiles/alpine.docker| 3 ++- tests/docker/dockerfiles/centos8.docker | 1 + tests/docker/dockerfiles/debian-amd64-cross.docker| 3 ++- tests/docker/dockerfiles/debian-arm64-cross.docker| 3 ++- tests/docker/dockerfiles/debian-armel-cross.docker| 3 ++- tests/docker/dockerfiles/debian-armhf-cross.docker| 3 ++- tests/docker/dockerfiles/debian-i686-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mips64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mipsel-cross.docker | 3 ++- tests/docker/dockerfiles/debian-ppc64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-riscv64-cross.docker | 3 ++- tests/docker/dockerfiles/debian-s390x-cross.docker| 3 ++- tests/docker/dockerfiles/debian.docker| 1 + tests/docker/dockerfiles/fedora-win64-cross.docker| 3 ++- tests/docker/dockerfiles/fedora.docker| 1 + tests/docker/dockerfiles/opensuse-leap.docker | 1 + tests/docker/dockerfiles/ubuntu2204.docker| 1 + 17 files changed, 29 insertions(+), 12 deletions(-) diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker index 42f6928627..cd9d7af1ce 100644 --- a/tests/docker/dockerfiles/alpine.docker +++ b/tests/docker/dockerfiles/alpine.docker @@ -116,7 +116,8 @@ RUN apk update && \ zlib-static \ zstd \ zstd-dev && \ -apk list | sort > /packages.txt && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ +apk list --installed | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker index d97c30e96a..ea618bf352 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos8.docker @@ -123,6 +123,7 @@ RUN dnf distro-sync -y && \ zstd && \ dnf autoremove -y && \ dnf clean all -y && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ rpm -qa | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ diff --git a/tests/docker/dockerfiles/debian-amd64-cross.docker b/tests/docker/dockerfiles/debian-amd64-cross.docker index 00bdc06021..d0b0e9778e 100644 --- a/tests/docker/dockerfiles/debian-amd64-cross.docker +++ b/tests/docker/dockerfiles/debian-amd64-cross.docker @@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ -dpkg-reconfigure locales +dpkg-reconfigure locales && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker index 2dae3777f7..8cb225740e 100644 --- a/tests/docker/dockerfiles/debian-arm64-cross.docker +++ b/tests/docker/dockerfiles/debian-arm64-cross.docker @@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ -dpkg-reconfigure locales +dpkg-reconfigure locales && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/docker/dockerfiles/debian-armel-cross.docker index 75342c09b0..e6f37418ed 100644 --- a/tests/docker/dockerfiles/debian-armel-cross.docker +++ b/tests/docker/dockerfiles/debian-armel-cross.docker @@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ -dpkg-reconfigure locales +dpkg-reconfigure locales && \ +rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED RUN /usr/bin/pip3 install tomli diff --git a/tests/docker/dockerfiles/debian-armhf-cross.docker b/tests/docker/dockerfiles/debian-armhf-cross.docker index 180ed836e6..407a014f57 100644 --- a/tests/docker/dockerfiles/debian-armhf-cross.docker +++ b/tests/do
[PATCH v2 09/13] block/gluster: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Signed-off-by: Thomas Huth --- block/gluster.c | 71 - 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index cc74af06dc..1c9505f8bb 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -17,7 +17,6 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h" @@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs) } } -static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) +static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path) { -char *p, *q; +const char *p, *q; if (!path) { return -EINVAL; @@ -349,13 +348,13 @@ static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, const char *filename) { +g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); +g_autoptr(GHashTable) qp = NULL; SocketAddress *gsconf; -URI *uri; -QueryParams *qp = NULL; bool is_unix = false; -int ret = 0; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port, ret; -uri = uri_parse(filename); if (!uri) { return -EINVAL; } @@ -364,57 +363,57 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, QAPI_LIST_PREPEND(gconf->server, gsconf); /* transport */ -if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { +uri_scheme = g_uri_get_scheme(uri); +if (!uri_scheme || !strcmp(uri_scheme, "gluster")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+tcp")) { +} else if (!strcmp(uri_scheme, "gluster+tcp")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+unix")) { +} else if (!strcmp(uri_scheme, "gluster+unix")) { gsconf->type = SOCKET_ADDRESS_TYPE_UNIX; is_unix = true; -} else if (!strcmp(uri->scheme, "gluster+rdma")) { +} else if (!strcmp(uri_scheme, "gluster+rdma")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; warn_report("rdma feature is not supported, falling back to tcp"); } else { -ret = -EINVAL; -goto out; +return -EINVAL; } -ret = parse_volume_options(gconf, uri->path); +ret = parse_volume_options(gconf, g_uri_get_path(uri)); if (ret < 0) { -goto out; +return ret; } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +return -EINVAL; +} +ret = g_hash_table_size(qp); +if (ret > 1 || (is_unix && !ret) || (!is_unix && ret)) { +return -EINVAL; +} } +uri_server = g_uri_get_host(uri); +uri_port = g_uri_get_port(uri); + if (is_unix) { -if (uri->server || uri->port) { -ret = -EINVAL; -goto out; -} -if (strcmp(qp->p[0].name, "socket")) { -ret = -EINVAL; -goto out; +char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { +return -EINVAL; } -gsconf->u.q_unix.path = g_strdup(qp->p[0].value); +gsconf->u.q_unix.path = g_strdup(uri_socket); } else { -gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost"); -if (uri->port) { -gsconf->u.inet.port = g_strdup_printf("%d", uri->port); +gsconf->u.inet.host = g_strdup(uri_server ? uri_server : "localhost"); +if (uri_port > 0) { +gsconf->u.inet.port = g_strdup_printf("%d", uri_port); } else { gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT); } } -out: -if (qp) { -query_params_free(qp); -} -uri_free(uri); -return ret; +return 0; } static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, -- 2.44.0
[PATCH v2 00/13] Drop old distros, bump glib and switch to glib URI parsing code
In the QEMU 9.1 development cycle, we can drop the support for Ubuntu 20.04 and CentOS 8 since the following major versions of these distributions are available since 2 years already. This allows us to bump the minimum version of glib to 2.66 which comes with a nice set of URI parsing functions. By switching to these parsing functions, we can finally drop our own URI parsing code in util/uri.c. NB: We also need to update some of the custom runners in our CI environment first (since they still use Ubuntu 20.04). v2: - Added Paolo's patch to bump the external CI runners - Added patch to drop more glib compatibility hunks - Use g_autoptr() in the URI patches for simplification - Don't allow port 0 in the URIs Paolo Bonzini (1): ci: move external build environment setups to CentOS Stream 9 Thomas Huth (12): tests: Remove Ubuntu 20.04 container tests/lcitool/libvirt-ci: Update to the latest master branch tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update tests: Update our CI to use CentOS Stream 9 instead of 8 .travis.yml: Update the jobs to Ubuntu 22.04 Bump minimum glib version to v2.66 Remove glib compatibility code that is not required anymore block/gluster: Use URI parsing code from glib block/nbd: Use URI parsing code from glib block/nfs: Use URI parsing code from glib block/ssh: Use URI parsing code from glib util/uri: Remove the old URI parsing code meson.build | 16 +- include/glib-compat.h | 27 +- include/qemu/uri.h| 99 -- block/gluster.c | 71 +- block/nbd.c | 76 +- block/nfs.c | 110 +- block/ssh.c | 75 +- qga/commands-posix-ssh.c | 12 +- util/error-report.c | 10 - util/uri.c| 1466 - .gitlab-ci.d/buildtest.yml| 16 +- .gitlab-ci.d/container-core.yml |4 +- .travis.yml | 13 +- .../stream/{8 => 9}/build-environment.yml | 31 +- .../stream/{8 => 9}/x86_64/configure |4 +- .../stream/{8 => 9}/x86_64/test-avocado |0 scripts/ci/setup/build-environment.yml| 44 +- tests/docker/dockerfiles/alpine.docker|3 +- .../{centos8.docker => centos9.docker}| 35 +- .../dockerfiles/debian-amd64-cross.docker |3 +- .../dockerfiles/debian-arm64-cross.docker |3 +- .../dockerfiles/debian-armel-cross.docker |3 +- .../dockerfiles/debian-armhf-cross.docker |3 +- .../dockerfiles/debian-i686-cross.docker |3 +- .../dockerfiles/debian-mips64el-cross.docker |3 +- .../dockerfiles/debian-mipsel-cross.docker|3 +- .../dockerfiles/debian-ppc64el-cross.docker |3 +- .../dockerfiles/debian-riscv64-cross.docker |3 +- .../dockerfiles/debian-s390x-cross.docker |3 +- tests/docker/dockerfiles/debian.docker|1 + .../dockerfiles/fedora-win64-cross.docker |3 +- tests/docker/dockerfiles/fedora.docker|1 + tests/docker/dockerfiles/opensuse-leap.docker |1 + tests/docker/dockerfiles/ubuntu2004.docker| 157 -- tests/docker/dockerfiles/ubuntu2204.docker|1 + tests/lcitool/libvirt-ci |2 +- tests/lcitool/mappings.yml| 20 - tests/lcitool/refresh |3 +- tests/vm/centos |4 +- util/meson.build |2 +- 40 files changed, 265 insertions(+), 2072 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%) rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%) rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker -- 2.44.0
[PATCH v2 02/13] tests/lcitool/libvirt-ci: Update to the latest master branch
We need the latest fixes for the lcitool to be able to properly update our CentOS docker file to CentOS Stream 9. Signed-off-by: Thomas Huth --- tests/lcitool/libvirt-ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci index 77c800186f..cec6703971 16 --- a/tests/lcitool/libvirt-ci +++ b/tests/lcitool/libvirt-ci @@ -1 +1 @@ -Subproject commit 77c800186f34b21be7660750577cc5582a914deb +Subproject commit cec67039719becbfbab866f9c23574f389cf9559 -- 2.44.0
[PATCH v2 07/13] Bump minimum glib version to v2.66
Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are: CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5:2.70.5 pkgsrc_current:2.78.4 Ubuntu 22.04: 2.72.1 Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches. Signed-off-by: Thomas Huth --- meson.build | 16 +--- include/glib-compat.h| 27 ++- qga/commands-posix-ssh.c | 4 ++-- 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index c9c3217ba4..c0aaceffc0 100644 --- a/meson.build +++ b/meson.build @@ -865,7 +865,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ # When bumping glib minimum version, please check also whether to increase # the _WIN32_WINNT setting in osdep.h according to the value from glib -glib_req_ver = '>=2.56.0' +glib_req_ver = '>=2.66.0' glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true, method: 'pkg-config') glib_cflags = [] @@ -906,20 +906,6 @@ if not cc.compiles(''' to the right pkg-config files for your build target.''') endif -# Silence clang warnings triggered by glib < 2.57.2 -if not cc.compiles(''' - #include - typedef struct Foo { -int i; - } Foo; - static void foo_free(Foo *f) - { -g_free(f); - } - G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free) - int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror']) - glib_cflags += cc.get_supported_arguments('-Wno-unused-function') -endif glib = declare_dependency(dependencies: [glib_pc, gmodule], compile_args: glib_cflags, version: glib_pc.version()) diff --git a/include/glib-compat.h b/include/glib-compat.h index 43a562974d..86be439ba0 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -19,12 +19,12 @@ /* Ask for warnings for anything that was marked deprecated in * the defined version, or before. It is a candidate for rewrite. */ -#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56 +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66 /* Ask for warnings if code tries to use function that did not * exist in the defined version. These risk breaking builds */ -#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56 +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) } #define g_memdup2(m, s) g_memdup2_qemu(m, s) -#if defined(G_OS_UNIX) -/* - * Note: The fallback implementation is not MT-safe, and it returns a copy of - * the libc passwd (must be g_free() after use) but not the content. Because of - * these important differences the caller must be aware of, it's not #define for - * GLib API substitution. - */ -static inline struct passwd * -g_unix_get_passwd_entry_qemu(const gchar *user_name, GError **error) -{ -#if GLIB_CHECK_VERSION(2, 64, 0) -return g_unix_get_passwd_entry(user_name, error); -#else -struct passwd *p = getpwnam(user_name); -if (!p) { -g_set_error_literal(error, G_UNIX_ERROR, 0, g_strerror(errno)); -return NULL; -} -return (struct passwd *)g_memdup(p, sizeof(*p)); -#endif -} -#endif /* G_OS_UNIX */ - static inline bool qemu_g_test_slow(void) { diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index 236f80de44..b0e0b1d674 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -35,7 +35,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error) return p; } -#define g_unix_get_passwd_entry_qemu(username, err) \ +#define g_unix_get_passwd_entry(username, err) \ test_get_passwd_entry(username, err) #endif @@ -45,7 +45,7 @@ get_passwd_entry(const char *username, Error **errp) g_autoptr(GError) err = NULL; struct passwd *p; -p = g_unix_get_passwd_entry_qemu(username, &err); +p = g_unix_get_passwd_entry(username, &err); if (p == NULL) { error_setg(errp, "failed to lookup user '%s': %s", username, err->message); -- 2.44.0
[PATCH v2 01/13] tests: Remove Ubuntu 20.04 container
Since Ubuntu 22.04 is now available since two years, we can stop actively supporting the previous LTS version of Ubuntu now. Signed-off-by: Thomas Huth --- tests/docker/dockerfiles/ubuntu2004.docker | 157 - tests/lcitool/refresh | 1 - 2 files changed, 158 deletions(-) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker deleted file mode 100644 index d3e212060c..00 --- a/tests/docker/dockerfiles/ubuntu2004.docker +++ /dev/null @@ -1,157 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool dockerfile --layers all ubuntu-2004 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -FROM docker.io/library/ubuntu:20.04 - -RUN export DEBIAN_FRONTEND=noninteractive && \ -apt-get update && \ -apt-get install -y eatmydata && \ -eatmydata apt-get dist-upgrade -y && \ -eatmydata apt-get install --no-install-recommends -y \ - bash \ - bc \ - bison \ - bsdmainutils \ - bzip2 \ - ca-certificates \ - ccache \ - clang \ - dbus \ - debianutils \ - diffutils \ - exuberant-ctags \ - findutils \ - flex \ - g++ \ - gcc \ - gcovr \ - gettext \ - git \ - hostname \ - libaio-dev \ - libasan6 \ - libasound2-dev \ - libattr1-dev \ - libbrlapi-dev \ - libbz2-dev \ - libc6-dev \ - libcacard-dev \ - libcap-ng-dev \ - libcapstone-dev \ - libcmocka-dev \ - libcurl4-gnutls-dev \ - libdaxctl-dev \ - libdrm-dev \ - libepoxy-dev \ - libfdt-dev \ - libffi-dev \ - libfuse3-dev \ - libgbm-dev \ - libgcrypt20-dev \ - libglib2.0-dev \ - libglusterfs-dev \ - libgnutls28-dev \ - libgtk-3-dev \ - libibumad-dev \ - libibverbs-dev \ - libiscsi-dev \ - libjemalloc-dev \ - libjpeg-turbo8-dev \ - libjson-c-dev \ - liblttng-ust-dev \ - liblzo2-dev \ - libncursesw5-dev \ - libnfs-dev \ - libnuma-dev \ - libpam0g-dev \ - libpcre2-dev \ - libpixman-1-dev \ - libpmem-dev \ - libpng-dev \ - libpulse-dev \ - librbd-dev \ - librdmacm-dev \ - libsasl2-dev \ - libsdl2-dev \ - libsdl2-image-dev \ - libseccomp-dev \ - libselinux1-dev \ - libslirp-dev \ - libsnappy-dev \ - libsndio-dev \ - libspice-protocol-dev \ - libspice-server-dev \ - libssh-dev \ - libsystemd-dev \ - libtasn1-6-dev \ - libubsan1 \ - libudev-dev \ - libusb-1.0-0-dev \ - libusbredirhost-dev \ - libvdeplug-dev \ - libvirglrenderer-dev \ - libvte-2.91-dev \ - libxen-dev \ - libzstd-dev \ - llvm \ - locales \ - make \ - mtools \ - multipath-tools \ - ncat \ - nettle-dev \ - ninja-build \ - openssh-client \ - pkgconf \ - python3 \ - python3-numpy \ - python3-opencv \ - python3-pillow \ - python3-pip \ - python3-setuptools \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ - python3-wheel \ -
Re: [PATCH for-9.1 4/9] Bump minimum glib version to v2.66
On 12/04/2024 12.16, Paolo Bonzini wrote: On Thu, Mar 28, 2024 at 3:06 PM Thomas Huth wrote: Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are: CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5:2.70.5 pkgsrc_current:2.78.4 Ubuntu 22.04: 2.72.1 Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches. Missing: diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index b0e0b1d674f..cc1f5a708e4 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -288,7 +288,6 @@ qmp_guest_ssh_get_authorized_keys( } #ifdef QGA_BUILD_UNIT_TEST -#if GLIB_CHECK_VERSION(2, 60, 0) static const strList test_key2 = { .value = (char *)"algo key2 comments" }; @@ -484,11 +483,4 @@ int main(int argc, char *argv[]) return g_test_run(); } -#else -int main(int argc, char *argv[]) -{ -g_test_message("test skipped, needs glib >= 2.60"); -return 0; -} -#endif /* GLIB_2_60 */ #endif /* BUILD_UNIT_TEST */ Indeed! And there seems to be another GLIB_CHECK_VERSION(2,62,0) check in util/error-report.c which we likely can clean up now, too! Thomas
Re: [PATCH 05/12] system/qtest: Replace sprintf() by g_string_append_printf()
On 10/04/2024 18.06, Philippe Mathieu-Daudé wrote: sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developper experience. Replace sprintf() by GString API uses in order to avoid: [120/169] Compiling C object libcommon.fa.p/system_qtest.c.o system/qtest.c:623:13: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(&enc[i * 2], "%02x", data[i]); ^ 1 warning generated. Signed-off-by: Philippe Mathieu-Daudé --- system/qtest.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) Reviewed-by: Thomas Huth
Re: [PATCH-for-9.1 v2 3/3] block/gluster: Remove RDMA protocol handling
On 28/03/2024 14.02, Philippe Mathieu-Daudé wrote: GlusterFS+RDMA has been deprecated 8 years ago in commit 0552ff2465 ("block/gluster: deprecate rdma support"): gluster volfile server fetch happens through unix and/or tcp, it doesn't support volfile fetch over rdma. The rdma code may actually mislead, so to make sure things do not break, for now we fallback to tcp when requested for rdma, with a warning. If you are wondering how this worked all these days, its the gluster libgfapi code which handles anything other than unix transport as socket/tcp, sad but true. Besides, the whole RDMA subsystem was deprecated in commit e9a54265f5 ("hw/rdma: Deprecate the pvrdma device and the rdma subsystem") released in v8.2. Cc: Prasanna Kumar Kalever Signed-off-by: Philippe Mathieu-Daudé --- docs/system/device-url-syntax.rst.inc | 4 +-- docs/system/qemu-block-drivers.rst.inc | 1 - block/gluster.c| 39 -- 3 files changed, 2 insertions(+), 42 deletions(-) Reviewed-by: Thomas Huth
Re: [PATCH-for-9.1 v2 1/3] hw/rdma: Remove pvrdma device and rdmacm-mux helper
On 28/03/2024 14.02, Philippe Mathieu-Daudé wrote: The whole RDMA subsystem was deprecated in commit e9a54265f5 ("hw/rdma: Deprecate the pvrdma device and the rdma subsystem") released in v8.2. Remove: - PVRDMA device - generated vmw_pvrdma/ directory from linux-headers - rdmacm-mux tool from contrib/ Cc: Yuval Shaia Cc: Marcel Apfelbaum Signed-off-by: Philippe Mathieu-Daudé --- Reviewed-by: Thomas Huth
Re: [PATCH for-9.1 6/9] block/nbd: Use URI parsing code from glib
On 28/03/2024 15.59, Daniel P. Berrangé wrote: On Thu, Mar 28, 2024 at 09:54:49AM -0500, Eric Blake wrote: On Thu, Mar 28, 2024 at 03:06:03PM +0100, Thomas Huth wrote: Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too. Signed-off-by: Thomas Huth --- block/nbd.c | 66 ++--- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index ef05f7cdfd..95b507f872 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "trace.h" -#include "qemu/uri.h" #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" @@ -1514,30 +1513,34 @@ static void nbd_client_close(BlockDriverState *bs) static int nbd_parse_uri(const char *filename, QDict *options) { -URI *uri; +GUri *uri; Is it worth using 'g_autoptr(GUri) uri = NULL;' here, to simplify cleanup later? Sounds like a good idea, I'll give it a try! const char *p; -QueryParams *qp = NULL; +GHashTable *qp = NULL; Presumably would be easier if qp is also auto-free. +int qp_n; int ret = 0; bool is_unix; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; -uri = uri_parse(filename); +uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); The glib API is fairly close to what we have in qemu, making this a nice switchover. /* nbd[+tcp]://host[:port]/export */ -if (!uri->server) { +if (!uri_server) { ret = -EINVAL; goto out; } -/* strip braces from literal IPv6 address */ -if (uri->server[0] == '[') { -host = qstring_from_substr(uri->server, 1, - strlen(uri->server) - 1); -} else { -host = qstring_from_str(uri->server); -} - qdict_put_str(options, "server.type", "inet"); -qdict_put(options, "server.host", host); +qdict_put_str(options, "server.host", uri_server); -port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); +port_str = g_strdup_printf("%d", uri_port != -1 ? uri_port +: NBD_DEFAULT_PORT); qdict_put_str(options, "server.port", port_str); If a user requests nbd://hostname:0/export, this now sets server.port to "0" instead of "10809". Is that an intentional change? No one actually passes an explicit ":0" port on purpose, but we do have to worry about malicious URIs. Passing '0' will cause the kernel to allocate a random free port, so that is potentially introducing new semantics ? Ok, so passing a 0 does not really make sense, since QEMU needs to know the exact port. I'll change the check from "uri_port != -1" to "uri_port > 0" in the next version. Thomas
Re: [PATCH-for-9.1 v2 2/3] migration: Remove RDMA protocol handling
On 28/03/2024 16.01, Peter Xu wrote: On Thu, Mar 28, 2024 at 11:18:04AM -0300, Fabiano Rosas wrote: Philippe Mathieu-Daudé writes: The whole RDMA subsystem was deprecated in commit e9a54265f5 ("hw/rdma: Deprecate the pvrdma device and the rdma subsystem") released in v8.2. Remove: - RDMA handling from migration - dependencies on libibumad, libibverbs and librdmacm Keep the RAM_SAVE_FLAG_HOOK definition since it might appears in old migration streams. Cc: Peter Xu Cc: Li Zhijian Acked-by: Fabiano Rosas Signed-off-by: Philippe Mathieu-Daudé Just to be clear, because people raised the point in the last version, the first link in the deprecation commit links to a thread comprising entirely of rdma migration patches. I don't see any ambiguity on whether the deprecation was intended to include migration. There's even an ack from Juan. Yes I remember that's the plan. So on the basis of not reverting the previous maintainer's decision, my Ack stands here. We also had pretty obvious bugs ([1], [2]) in the past that would have been caught if we had any kind of testing for the feature, so I can't even say this thing works currently. @Peter Xu, @Li Zhijian, what are your thoughts on this? Generally I definitely agree with such a removal sooner or later, as that's how deprecation works, and even after Juan's left I'm not aware of any other new RDMA users. Personally, I'd slightly prefer postponing it one more release which might help a bit of our downstream maintenance, however I assume that's not a blocker either, as I think we can also manage it. IMHO it's more important to know whether there are still users and whether they would still like to see it around. Since e9a54265f5 was not very clear about rdma migration code, should we maybe rather add a separate deprecation note for the migration part, and add a proper warning message to the migration code in case someone tries to use it there, and then only remove the rdma migration code after two more releases? Thomas
[PATCH for-9.1 8/9] block/ssh: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Signed-off-by: Thomas Huth --- block/ssh.c | 69 +++-- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/block/ssh.c b/block/ssh.c index 2748253d4a..c0caf59793 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -37,7 +37,6 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" -#include "qemu/uri.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" @@ -181,64 +180,76 @@ static void sftp_error_trace(BDRVSSHState *s, const char *op) static int parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp; +GUri *uri; +const char *uri_host, *uri_path, *uri_user, *uri_query; char *port_str; -int i; +int port; +g_autoptr(GError) gerror = NULL; +char *qp_name, *qp_value; +GUriParamsIter qp; -uri = uri_parse(filename); +uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); if (!uri) { return -EINVAL; } -if (g_strcmp0(uri->scheme, "ssh") != 0) { +if (g_strcmp0(g_uri_get_scheme(uri), "ssh") != 0) { error_setg(errp, "URI scheme must be 'ssh'"); goto err; } -if (!uri->server || strcmp(uri->server, "") == 0) { +uri_host = g_uri_get_host(uri); +if (!uri_host || g_str_equal(uri_host, "")) { error_setg(errp, "missing hostname in URI"); goto err; } -if (!uri->path || strcmp(uri->path, "") == 0) { +uri_path = g_uri_get_path(uri); +if (!uri_path || g_str_equal(uri_path, "")) { error_setg(errp, "missing remote path in URI"); goto err; } -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto err; -} - -if(uri->user && strcmp(uri->user, "") != 0) { -qdict_put_str(options, "user", uri->user); +uri_user = g_uri_get_user(uri); +if (uri_user && !g_str_equal(uri_user, "")) { +qdict_put_str(options, "user", uri_user); } -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_host); -port_str = g_strdup_printf("%d", uri->port ?: 22); +port = g_uri_get_port(uri); +port_str = g_strdup_printf("%d", port != -1 ? port : 22); qdict_put_str(options, "server.port", port_str); g_free(port_str); -qdict_put_str(options, "path", uri->path); - -/* Pick out any query parameters that we understand, and ignore - * the rest. - */ -for (i = 0; i < qp->n; ++i) { -if (strcmp(qp->p[i].name, "host_key_check") == 0) { -qdict_put_str(options, "host_key_check", qp->p[i].value); +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +if (!qp_name || !qp_value || gerror) { +warn_report("Failed to parse SSH URI parameters '%s'.", +uri_query); +break; +} +/* + * Pick out the query parameters that we understand, and ignore + * (or rather warn about) the rest. + */ +if (g_str_equal(qp_name, "host_key_check")) { +qdict_put_str(options, "host_key_check", qp_value); +} else { +warn_report("Unsupported parameter '%s' in URI.", qp_name); +} } } -query_params_free(qp); -uri_free(uri); +g_uri_unref(uri); return 0; err: -uri_free(uri); +g_uri_unref(uri); return -EINVAL; } -- 2.44.0
[PATCH for-9.1 7/9] block/nfs: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Signed-off-by: Thomas Huth --- block/nfs.c | 102 ++-- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/block/nfs.c b/block/nfs.c index f737e19cd3..9550063695 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -38,7 +38,6 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/replay.h" #include "qapi/qapi-visit-block-core.h" @@ -79,76 +78,79 @@ typedef struct NFSRPC { static int nfs_parse_uri(const char *filename, QDict *options, Error **errp) { -URI *uri = NULL; -QueryParams *qp = NULL; -int ret = -EINVAL, i; - -uri = uri_parse(filename); +GUri *uri; +GUriParamsIter qp; +const char *uri_server, *uri_path, *uri_query; +char *qp_name, *qp_value; +GError *gerror = NULL; +int ret = -EINVAL; + +uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); if (!uri) { error_setg(errp, "Invalid URI specified"); goto out; } -if (g_strcmp0(uri->scheme, "nfs") != 0) { +if (!g_str_equal(g_uri_get_scheme(uri), "nfs")) { error_setg(errp, "URI scheme must be 'nfs'"); goto out; } -if (!uri->server) { +uri_server = g_uri_get_host(uri); +if (!uri_server || !uri_server[0]) { error_setg(errp, "missing hostname in URI"); goto out; } -if (!uri->path) { +uri_path = g_uri_get_path(uri); +if (!uri_path || !uri_path[0]) { error_setg(errp, "missing file path in URI"); goto out; } -qp = query_params_parse(uri->query); -if (!qp) { -error_setg(errp, "could not parse query parameters"); -goto out; -} - -qdict_put_str(options, "server.host", uri->server); +qdict_put_str(options, "server.host", uri_server); qdict_put_str(options, "server.type", "inet"); -qdict_put_str(options, "path", uri->path); - -for (i = 0; i < qp->n; i++) { -uint64_t val; -if (!qp->p[i].value) { -error_setg(errp, "Value for NFS parameter expected: %s", - qp->p[i].name); -goto out; -} -if (parse_uint_full(qp->p[i].value, 0, &val)) { -error_setg(errp, "Illegal value for NFS parameter: %s", - qp->p[i].name); -goto out; -} -if (!strcmp(qp->p[i].name, "uid")) { -qdict_put_str(options, "user", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "gid")) { -qdict_put_str(options, "group", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "tcp-syncnt")) { -qdict_put_str(options, "tcp-syn-count", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "readahead")) { -qdict_put_str(options, "readahead-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "pagecache")) { -qdict_put_str(options, "page-cache-size", qp->p[i].value); -} else if (!strcmp(qp->p[i].name, "debug")) { -qdict_put_str(options, "debug", qp->p[i].value); -} else { -error_setg(errp, "Unknown NFS parameter name: %s", - qp->p[i].name); -goto out; +qdict_put_str(options, "path", uri_path); + +uri_query = g_uri_get_query(uri); +if (uri_query) { +g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE); +while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) { +uint64_t val; +if (!qp_name || gerror) { +error_setg(errp, "Failed to parse NFS parameter"); +goto out; +} +if (!qp_value) { +error_setg(errp, "Value for NFS parameter expected: %s", + qp_name); +goto out; +} +if (parse_uint_full(qp_value, 0, &val)) { +error_setg(errp, "Illegal value for NFS parameter: %s", + qp_name); +goto out; +} +if (g_str_equal(qp_name, "uid")) { +qdict_put_str(options, "user", qp_value); +} else if (g_str_equal(qp_name, "gid")) { +qdict_put_s
[PATCH for-9.1 1/9] tests: Remove Ubuntu 20.04 container
Since Ubuntu 22.04 is now available since two years, we can stop actively supporting the previous LTS version of Ubuntu now. Signed-off-by: Thomas Huth --- tests/docker/dockerfiles/ubuntu2004.docker | 157 - tests/lcitool/refresh | 1 - 2 files changed, 158 deletions(-) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker deleted file mode 100644 index d3e212060c..00 --- a/tests/docker/dockerfiles/ubuntu2004.docker +++ /dev/null @@ -1,157 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool dockerfile --layers all ubuntu-2004 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -FROM docker.io/library/ubuntu:20.04 - -RUN export DEBIAN_FRONTEND=noninteractive && \ -apt-get update && \ -apt-get install -y eatmydata && \ -eatmydata apt-get dist-upgrade -y && \ -eatmydata apt-get install --no-install-recommends -y \ - bash \ - bc \ - bison \ - bsdmainutils \ - bzip2 \ - ca-certificates \ - ccache \ - clang \ - dbus \ - debianutils \ - diffutils \ - exuberant-ctags \ - findutils \ - flex \ - g++ \ - gcc \ - gcovr \ - gettext \ - git \ - hostname \ - libaio-dev \ - libasan6 \ - libasound2-dev \ - libattr1-dev \ - libbrlapi-dev \ - libbz2-dev \ - libc6-dev \ - libcacard-dev \ - libcap-ng-dev \ - libcapstone-dev \ - libcmocka-dev \ - libcurl4-gnutls-dev \ - libdaxctl-dev \ - libdrm-dev \ - libepoxy-dev \ - libfdt-dev \ - libffi-dev \ - libfuse3-dev \ - libgbm-dev \ - libgcrypt20-dev \ - libglib2.0-dev \ - libglusterfs-dev \ - libgnutls28-dev \ - libgtk-3-dev \ - libibumad-dev \ - libibverbs-dev \ - libiscsi-dev \ - libjemalloc-dev \ - libjpeg-turbo8-dev \ - libjson-c-dev \ - liblttng-ust-dev \ - liblzo2-dev \ - libncursesw5-dev \ - libnfs-dev \ - libnuma-dev \ - libpam0g-dev \ - libpcre2-dev \ - libpixman-1-dev \ - libpmem-dev \ - libpng-dev \ - libpulse-dev \ - librbd-dev \ - librdmacm-dev \ - libsasl2-dev \ - libsdl2-dev \ - libsdl2-image-dev \ - libseccomp-dev \ - libselinux1-dev \ - libslirp-dev \ - libsnappy-dev \ - libsndio-dev \ - libspice-protocol-dev \ - libspice-server-dev \ - libssh-dev \ - libsystemd-dev \ - libtasn1-6-dev \ - libubsan1 \ - libudev-dev \ - libusb-1.0-0-dev \ - libusbredirhost-dev \ - libvdeplug-dev \ - libvirglrenderer-dev \ - libvte-2.91-dev \ - libxen-dev \ - libzstd-dev \ - llvm \ - locales \ - make \ - mtools \ - multipath-tools \ - ncat \ - nettle-dev \ - ninja-build \ - openssh-client \ - pkgconf \ - python3 \ - python3-numpy \ - python3-opencv \ - python3-pillow \ - python3-pip \ - python3-setuptools \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ - python3-wheel \ -
[PATCH for-9.1 6/9] block/nbd: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too. Signed-off-by: Thomas Huth --- block/nbd.c | 66 ++--- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index ef05f7cdfd..95b507f872 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -31,7 +31,6 @@ #include "qemu/osdep.h" #include "trace.h" -#include "qemu/uri.h" #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" @@ -1514,30 +1513,34 @@ static void nbd_client_close(BlockDriverState *bs) static int nbd_parse_uri(const char *filename, QDict *options) { -URI *uri; +GUri *uri; const char *p; -QueryParams *qp = NULL; +GHashTable *qp = NULL; +int qp_n; int ret = 0; bool is_unix; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; -uri = uri_parse(filename); +uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); if (!uri) { return -EINVAL; } /* transport */ -if (!g_strcmp0(uri->scheme, "nbd")) { +uri_scheme = g_uri_get_scheme(uri); +if (!g_strcmp0(uri_scheme, "nbd")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+tcp")) { +} else if (!g_strcmp0(uri_scheme, "nbd+tcp")) { is_unix = false; -} else if (!g_strcmp0(uri->scheme, "nbd+unix")) { +} else if (!g_strcmp0(uri_scheme, "nbd+unix")) { is_unix = true; } else { ret = -EINVAL; goto out; } -p = uri->path ? uri->path : ""; +p = g_uri_get_path(uri) ?: ""; if (p[0] == '/') { p++; } @@ -1545,51 +1548,58 @@ static int nbd_parse_uri(const char *filename, QDict *options) qdict_put_str(options, "export", p); } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +ret = -EINVAL; +goto out; +} +qp_n = g_hash_table_size(qp); +if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) { +ret = -EINVAL; +goto out; +} + } + +uri_server = g_uri_get_host(uri); +if (uri_server && !uri_server[0]) { +uri_server = NULL; } +uri_port = g_uri_get_port(uri); if (is_unix) { /* nbd+unix:///export?socket=path */ -if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) { +const char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { ret = -EINVAL; goto out; } qdict_put_str(options, "server.type", "unix"); -qdict_put_str(options, "server.path", qp->p[0].value); +qdict_put_str(options, "server.path", uri_socket); } else { -QString *host; char *port_str; /* nbd[+tcp]://host[:port]/export */ -if (!uri->server) { +if (!uri_server) { ret = -EINVAL; goto out; } -/* strip braces from literal IPv6 address */ -if (uri->server[0] == '[') { -host = qstring_from_substr(uri->server, 1, - strlen(uri->server) - 1); -} else { -host = qstring_from_str(uri->server); -} - qdict_put_str(options, "server.type", "inet"); -qdict_put(options, "server.host", host); +qdict_put_str(options, "server.host", uri_server); -port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT); +port_str = g_strdup_printf("%d", uri_port != -1 ? uri_port +: NBD_DEFAULT_PORT); qdict_put_str(options, "server.port", port_str); g_free(port_str); } out: if (qp) { -query_params_free(qp); +g_hash_table_destroy(qp); } -uri_free(uri); +g_uri_unref(uri); return ret; } -- 2.44.0
[PATCH for-9.1 3/9] tests: Update our CI to use CentOS Stream 9 instead of 8
RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now. Thus upgrade our CentOS Stream container to major version 9 now. Signed-off-by: Thomas Huth --- .gitlab-ci.d/buildtest.yml| 16 - .gitlab-ci.d/container-core.yml | 4 +-- .../{centos8.docker => centos9.docker}| 34 +++ tests/lcitool/mappings.yml| 20 --- tests/lcitool/refresh | 2 +- tests/vm/centos | 4 +-- 6 files changed, 26 insertions(+), 54 deletions(-) rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index cfdff175c3..9f34c650d6 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -158,9 +158,9 @@ build-system-centos: - .native_build_job_template - .native_build_artifact_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server --enable-modules --enable-trace-backends=dtrace --enable-docs TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu @@ -242,7 +242,7 @@ check-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check avocado-system-centos: @@ -251,7 +251,7 @@ avocado-system-centos: - job: build-system-centos artifacts: true variables: -IMAGE: centos8 +IMAGE: centos9 MAKE_CHECK_ARGS: check-avocado AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 arch:nios2 @@ -327,9 +327,9 @@ avocado-system-flaky: build-tcg-disabled: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 script: - mkdir build - cd build @@ -651,9 +651,9 @@ build-tci: build-without-defaults: extends: .native_build_job_template needs: -job: amd64-centos8-container +job: amd64-centos9-container variables: -IMAGE: centos8 +IMAGE: centos9 CONFIGURE_ARGS: --without-default-devices --without-default-features diff --git a/.gitlab-ci.d/container-core.yml b/.gitlab-ci.d/container-core.yml index 08f8450fa1..5459447676 100644 --- a/.gitlab-ci.d/container-core.yml +++ b/.gitlab-ci.d/container-core.yml @@ -1,10 +1,10 @@ include: - local: '/.gitlab-ci.d/container-template.yml' -amd64-centos8-container: +amd64-centos9-container: extends: .container_job_template variables: -NAME: centos8 +NAME: centos9 amd64-fedora-container: extends: .container_job_template diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos9.docker similarity index 82% rename from tests/docker/dockerfiles/centos8.docker rename to tests/docker/dockerfiles/centos9.docker index d97c30e96a..9fc9b27eb7 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos9.docker @@ -1,15 +1,14 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all centos-stream-8 qemu +# $ lcitool dockerfile --layers all centos-stream-9 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM quay.io/centos/centos:stream8 +FROM quay.io/centos/centos:stream9 RUN dnf distro-sync -y && \ dnf install 'dnf-command(config-manager)' -y && \ -dnf config-manager --set-enabled -y powertools && \ -dnf install -y centos-release-advanced-virtualization && \ +dnf config-manager --set-enabled -y crb && \ dnf install -y epel-release && \ dnf install -y epel-next-release && \ dnf install -y \ @@ -42,7 +41,6 @@ RUN dnf distro-sync -y && \ glib2-static \ glibc-langpack-en \ glibc-static \ -glusterfs-api-devel \ gnutls-devel \ gtk3-devel \ hostname \ @@ -82,6 +80,7 @@ RUN dnf distro-sync -y && \ lzo-devel \ make \ mesa-libgbm-devel \ +meson \ mtools \ ncurses-devel \ nettle-devel \ @@ -95,25 +94,25 @@ RUN dnf distro-sync -y && \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \ -python38 \ -python38-PyYAML \ -python38-numpy \ -python38-pip \ -python38-setuptools \ -python38-wheel \ +python3 \ +python3-PyYAML \ +python3-numpy \ +python3-pillow \ +python3-pip \ +python3-sphinx \ +python3-sphinx_rtd_theme \ +python3-tomli \ rdma-core-devel
[PATCH for-9.1 5/9] block/gluster: Use URI parsing code from glib
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. Cc: integrat...@gluster.org Signed-off-by: Thomas Huth --- block/gluster.c | 63 + 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index cc74af06dc..f4cb95360e 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -17,7 +17,6 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h" @@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs) } } -static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path) +static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path) { -char *p, *q; +const char *p, *q; if (!path) { return -EINVAL; @@ -350,12 +349,15 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, const char *filename) { SocketAddress *gsconf; -URI *uri; -QueryParams *qp = NULL; +GUri *uri; +GHashTable *qp = NULL; +int qp_n; bool is_unix = false; int ret = 0; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; -uri = uri_parse(filename); +uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL); if (!uri) { return -EINVAL; } @@ -364,14 +366,15 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, QAPI_LIST_PREPEND(gconf->server, gsconf); /* transport */ -if (!uri->scheme || !strcmp(uri->scheme, "gluster")) { +uri_scheme = g_uri_get_scheme(uri); +if (!uri_scheme || !strcmp(uri_scheme, "gluster")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+tcp")) { +} else if (!strcmp(uri_scheme, "gluster+tcp")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; -} else if (!strcmp(uri->scheme, "gluster+unix")) { +} else if (!strcmp(uri_scheme, "gluster+unix")) { gsconf->type = SOCKET_ADDRESS_TYPE_UNIX; is_unix = true; -} else if (!strcmp(uri->scheme, "gluster+rdma")) { +} else if (!strcmp(uri_scheme, "gluster+rdma")) { gsconf->type = SOCKET_ADDRESS_TYPE_INET; warn_report("rdma feature is not supported, falling back to tcp"); } else { @@ -379,31 +382,39 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, goto out; } -ret = parse_volume_options(gconf, uri->path); +ret = parse_volume_options(gconf, g_uri_get_path(uri)); if (ret < 0) { goto out; } -qp = query_params_parse(uri->query); -if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { -ret = -EINVAL; -goto out; -} - -if (is_unix) { -if (uri->server || uri->port) { +uri_query = g_uri_get_query(uri); +if (uri_query) { +qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL); +if (!qp) { +ret = -EINVAL; +goto out; +} +qp_n = g_hash_table_size(qp); +if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) { ret = -EINVAL; goto out; } -if (strcmp(qp->p[0].name, "socket")) { +} + +uri_server = g_uri_get_host(uri); +uri_port = g_uri_get_port(uri); + +if (is_unix) { +char *uri_socket = g_hash_table_lookup(qp, "socket"); +if (uri_server || uri_port != -1 || !uri_socket) { ret = -EINVAL; goto out; } -gsconf->u.q_unix.path = g_strdup(qp->p[0].value); +gsconf->u.q_unix.path = g_strdup(uri_socket); } else { -gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost"); -if (uri->port) { -gsconf->u.inet.port = g_strdup_printf("%d", uri->port); +gsconf->u.inet.host = g_strdup(uri_server ? uri_server : "localhost"); +if (uri_port != -1) { +gsconf->u.inet.port = g_strdup_printf("%d", uri_port); } else { gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT); } @@ -411,9 +422,9 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, out: if (qp) { -query_params_free(qp); +g_hash_table_destroy(qp); } -uri_free(uri); +g_uri_unref(uri); return ret; } -- 2.44.0
[PATCH for-9.1 2/9] tests/lcitool/libvirt-ci: Update to the latest master branch
We need the latest fixes for the lcitool to be able to properly update our CentOS docker file to CentOS Stream 9. Signed-off-by: Thomas Huth --- tests/lcitool/libvirt-ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lcitool/libvirt-ci b/tests/lcitool/libvirt-ci index 77c800186f..e25d813a62 16 --- a/tests/lcitool/libvirt-ci +++ b/tests/lcitool/libvirt-ci @@ -1 +1 @@ -Subproject commit 77c800186f34b21be7660750577cc5582a914deb +Subproject commit e25d813a62fb8fa0ee7aa0748cf720b59a187e71 -- 2.44.0
[PATCH for-9.1 4/9] Bump minimum glib version to v2.66
Now that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are: CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5:2.70.5 pkgsrc_current:2.78.4 Ubuntu 22.04: 2.72.1 Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches. Signed-off-by: Thomas Huth --- meson.build | 16 +--- include/glib-compat.h| 27 ++- qga/commands-posix-ssh.c | 4 ++-- 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index c9c3217ba4..c0aaceffc0 100644 --- a/meson.build +++ b/meson.build @@ -865,7 +865,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ # When bumping glib minimum version, please check also whether to increase # the _WIN32_WINNT setting in osdep.h according to the value from glib -glib_req_ver = '>=2.56.0' +glib_req_ver = '>=2.66.0' glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true, method: 'pkg-config') glib_cflags = [] @@ -906,20 +906,6 @@ if not cc.compiles(''' to the right pkg-config files for your build target.''') endif -# Silence clang warnings triggered by glib < 2.57.2 -if not cc.compiles(''' - #include - typedef struct Foo { -int i; - } Foo; - static void foo_free(Foo *f) - { -g_free(f); - } - G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free) - int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror']) - glib_cflags += cc.get_supported_arguments('-Wno-unused-function') -endif glib = declare_dependency(dependencies: [glib_pc, gmodule], compile_args: glib_cflags, version: glib_pc.version()) diff --git a/include/glib-compat.h b/include/glib-compat.h index 43a562974d..86be439ba0 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -19,12 +19,12 @@ /* Ask for warnings for anything that was marked deprecated in * the defined version, or before. It is a candidate for rewrite. */ -#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56 +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66 /* Ask for warnings if code tries to use function that did not * exist in the defined version. These risk breaking builds */ -#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56 +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" @@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) } #define g_memdup2(m, s) g_memdup2_qemu(m, s) -#if defined(G_OS_UNIX) -/* - * Note: The fallback implementation is not MT-safe, and it returns a copy of - * the libc passwd (must be g_free() after use) but not the content. Because of - * these important differences the caller must be aware of, it's not #define for - * GLib API substitution. - */ -static inline struct passwd * -g_unix_get_passwd_entry_qemu(const gchar *user_name, GError **error) -{ -#if GLIB_CHECK_VERSION(2, 64, 0) -return g_unix_get_passwd_entry(user_name, error); -#else -struct passwd *p = getpwnam(user_name); -if (!p) { -g_set_error_literal(error, G_UNIX_ERROR, 0, g_strerror(errno)); -return NULL; -} -return (struct passwd *)g_memdup(p, sizeof(*p)); -#endif -} -#endif /* G_OS_UNIX */ - static inline bool qemu_g_test_slow(void) { diff --git a/qga/commands-posix-ssh.c b/qga/commands-posix-ssh.c index 236f80de44..b0e0b1d674 100644 --- a/qga/commands-posix-ssh.c +++ b/qga/commands-posix-ssh.c @@ -35,7 +35,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error) return p; } -#define g_unix_get_passwd_entry_qemu(username, err) \ +#define g_unix_get_passwd_entry(username, err) \ test_get_passwd_entry(username, err) #endif @@ -45,7 +45,7 @@ get_passwd_entry(const char *username, Error **errp) g_autoptr(GError) err = NULL; struct passwd *p; -p = g_unix_get_passwd_entry_qemu(username, &err); +p = g_unix_get_passwd_entry(username, &err); if (p == NULL) { error_setg(errp, "failed to lookup user '%s': %s", username, err->message); -- 2.44.0
[PATCH for-9.1 0/9] Switch to glib URI parsing code
In the QEMU 9.1 development cycle, we can drop the support for Ubuntu 20.04 and CentOS 8 since the following major versions of these distributions are available since 2 years already. This allows us to bump the minimum version of glib to 2.66 which comes with a nice set of URI parsing functions. By switching to these parsing functions, we can finally drop our own URI parsing code in util/uri.c. NB: We also need to update some of the custom runners in our CI environment first (since they still use Ubuntu 20.04). Thomas Huth (9): tests: Remove Ubuntu 20.04 container tests/lcitool/libvirt-ci: Update to the latest master branch tests: Update our CI to use CentOS Stream 9 instead of 8 Bump minimum glib version to v2.66 block/gluster: Use URI parsing code from glib block/nbd: Use URI parsing code from glib block/nfs: Use URI parsing code from glib block/ssh: Use URI parsing code from glib util/uri: Remove the old URI parsing code meson.build | 16 +- include/glib-compat.h | 27 +- include/qemu/uri.h| 99 -- block/gluster.c | 63 +- block/nbd.c | 66 +- block/nfs.c | 102 +- block/ssh.c | 69 +- qga/commands-posix-ssh.c |4 +- util/uri.c| 1466 - .gitlab-ci.d/buildtest.yml| 16 +- .gitlab-ci.d/container-core.yml |4 +- .../{centos8.docker => centos9.docker}| 34 +- tests/docker/dockerfiles/ubuntu2004.docker| 157 -- tests/lcitool/libvirt-ci |2 +- tests/lcitool/mappings.yml| 20 - tests/lcitool/refresh |3 +- tests/vm/centos |4 +- util/meson.build |2 +- 18 files changed, 200 insertions(+), 1954 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker -- 2.44.0
[PATCH for-9.1 9/9] util/uri: Remove the old URI parsing code
Now that we switched all consumers of the URI code to use the URI parsing functions from glib instead, we can remove our internal URI parsing code since it is not used anymore. Signed-off-by: Thomas Huth --- include/qemu/uri.h | 99 --- util/uri.c | 1466 util/meson.build |2 +- 3 files changed, 1 insertion(+), 1566 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c diff --git a/include/qemu/uri.h b/include/qemu/uri.h deleted file mode 100644 index 255e61f452..00 --- a/include/qemu/uri.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Daniel Veillard shall not - * be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from him. - * - * Author: Daniel Veillard - ** - * Copyright (C) 2007 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <https://www.gnu.org/licenses/>. - * - * Authors: - *Richard W.M. Jones - * - * Utility functions to help parse and assemble query strings. - */ - -#ifndef QEMU_URI_H -#define QEMU_URI_H - -/** - * URI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - */ -typedef struct URI { -char *scheme; /* the URI scheme */ -char *opaque; /* opaque part */ -char *authority; /* the authority part */ -char *server; /* the server part */ -char *user;/* the user part */ -int port; /* the port number */ -char *path;/* the path string */ -char *fragment;/* the fragment identifier */ -int cleanup; /* parsing potentially unclean URI */ -char *query; /* the query string (as it appears in the URI) */ -} URI; - -URI *uri_new(void); -URI *uri_parse(const char *str); -URI *uri_parse_raw(const char *str, int raw); -int uri_parse_into(URI *uri, const char *str); -char *uri_to_string(URI *uri); -void uri_free(URI *uri); - -/* Single web service query parameter 'name=value'. */ -typedef struct QueryParam { - char *name; /* Name (unescaped). */ - char *value; /* Value (unescaped). */ - int ignore; /* Ignore this field in qparam_get_query */ -} QueryParam; - -/* Set of parameters. */ -typedef struct QueryParams { - int n; /* number of parameters used */ - int alloc; /* allocated space */ - QueryParam *p; /* array of parameters */ -} QueryParams; - -QueryParams *query_params_new(int init_alloc); -QueryParams *query_params_parse(const char *query); -void query_params_free(QueryParams *ps); - -#endif /* QEMU_URI_H */ diff --git a/util/uri.c b/util/uri.c deleted file mode 100644 index 573174bf47..00 --- a/util/uri.c +++ /dev/null @@ -1,1466 +0,0 @@ -/** - * uri.c: set of generic URI related routines - * - * Reference: RFCs 3986, 2732 and 2373 - * - * Copyright (C) 1998-2003 Daniel Veillard. All Rights Re
Re: [PATCH-for-9.1] rdma: Remove RDMA subsystem and pvrdma device
On 27/03/2024 11.55, Philippe Mathieu-Daudé wrote: The whole RDMA subsystem was deprecated in commit e9a54265f5 ("hw/rdma: Deprecate the pvrdma device and the rdma subsystem") released in v8.2. Time to remove it. Keep the RAM_SAVE_FLAG_HOOK definition since it might appears in old migration streams. Remove the dependencies on libibumad and libibverbs. Remove the generated vmw_pvrdma/ directory from linux-headers. Remove RDMA handling from migration. Remove RDMA handling in GlusterFS block driver. Remove rdmacm-mux tool from contrib/. Remove PVRDMA device. Cc: Peter Xu Cc: Li Zhijian Cc: Yuval Shaia Cc: Marcel Apfelbaum Signed-off-by: Philippe Mathieu-Daudé --- MAINTAINERS | 17 - docs/about/deprecated.rst |9 - docs/about/removed-features.rst |4 + docs/devel/migration/main.rst |6 - docs/pvrdma.txt | 345 -- docs/rdma.txt | 420 -- docs/system/device-url-syntax.rst.inc |4 +- docs/system/loongarch/virt.rst|2 +- docs/system/qemu-block-drivers.rst.inc|1 - meson.build | 59 - qapi/machine.json | 17 - qapi/migration.json | 31 +- qapi/qapi-schema.json |1 - qapi/rdma.json| 38 - contrib/rdmacm-mux/rdmacm-mux.h | 61 - hw/rdma/rdma_backend.h| 129 - hw/rdma/rdma_backend_defs.h | 76 - hw/rdma/rdma_rm.h | 97 - hw/rdma/rdma_rm_defs.h| 146 - hw/rdma/rdma_utils.h | 63 - hw/rdma/trace.h |1 - hw/rdma/vmw/pvrdma.h | 144 - hw/rdma/vmw/pvrdma_dev_ring.h | 46 - hw/rdma/vmw/pvrdma_qp_ops.h | 28 - hw/rdma/vmw/trace.h |1 - include/hw/rdma/rdma.h| 37 - include/monitor/hmp.h |1 - .../infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 685 --- .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 348 -- .../standard-headers/rdma/vmw_pvrdma-abi.h| 310 -- migration/migration-stats.h |6 +- migration/migration.h |9 - migration/options.h |2 - migration/rdma.h | 69 - block/gluster.c | 39 - contrib/rdmacm-mux/main.c | 831 hw/core/machine-qmp-cmds.c| 32 - hw/rdma/rdma.c| 30 - hw/rdma/rdma_backend.c| 1401 -- hw/rdma/rdma_rm.c | 812 hw/rdma/rdma_utils.c | 126 - hw/rdma/vmw/pvrdma_cmd.c | 815 hw/rdma/vmw/pvrdma_dev_ring.c | 141 - hw/rdma/vmw/pvrdma_main.c | 735 --- hw/rdma/vmw/pvrdma_qp_ops.c | 298 -- migration/migration-stats.c |5 +- migration/migration.c | 31 - migration/options.c | 16 - migration/qemu-file.c |1 - migration/ram.c | 86 +- migration/rdma.c | 4184 - migration/savevm.c|2 +- monitor/qmp-cmds.c|1 - Kconfig.host |3 - contrib/rdmacm-mux/meson.build|7 - hmp-commands-info.hx | 13 - hw/Kconfig|1 - hw/meson.build|1 - hw/rdma/Kconfig |3 - hw/rdma/meson.build | 12 - hw/rdma/trace-events | 31 - hw/rdma/vmw/trace-events | 17 - meson_options.txt |4 - migration/meson.build |1 - migration/trace-events| 68 +- qapi/meson.build |1 - qemu-options.hx |6 - .../ci/org.centos/stream/8/x86_64/configure |1 - scripts/ci/setup/build-environment.yml|2 - scripts/coverity-scan/run-coverity-scan |2 +- scripts/meson-buildoptions.sh |6 - scripts/update-linux-headers.sh | 27 - tests/lcitool/projects/qemu.yml |2 - tests/migration/guestperf/engine.py |4 +- 74 files changed, 20 insertions(+), 12991 dele
Re: [PATCH-for-9.0? v2 3/4] qtest/libqos: Reduce size_to_prdtl() declaration scope
On 26/03/2024 18.10, Philippe Mathieu-Daudé wrote: Since size_to_prdtl() is only used within ahci.c, declare it statically. This removes the last use of "inlined function with external linkage". See previous commit and commit 9de9fa5cf2 for rationale. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé --- Reviewed-by: Thomas Huth
Re: how do the iotests pick a machine model to run on ?
On 19/01/2024 17.18, Peter Maydell wrote: On Fri, 19 Jan 2024 at 15:26, Peter Maydell wrote: (Also, we should probably put an entry for sh4 in machine_map, because the default board type (shix) is about to be deprecated, and the r2d board type is thus a better choice.) The good news is if we add r2d to the machine_map, then only 3 iotests fail: 191 -- not sure exactly what's going on. QEMU complains "machine type does not support if=ide,bus=0,unit=1". Side note: the test harness seems to throw away the stderr from QEMU with this error message, leaving the test failure log rather uninformative. I had to run everything under strace to get hold of it. 203 -- this wants a machine type that can be migrated; sh4 CPUs don't support migration, so the test fails because the 'migrate' command returns the error {"error": {"class": "GenericError", "desc": "State blocked by non-migratable device 'cpu'"}} 267 -- similarly, wants a machine that supports snapshots, so fails when the loadvm/savevm get the error Error: State blocked by non-migratable device 'cpu' How should a test indicate "I need a machine type that supports migration" ? We could maybe add a flag to the machine_map to indicate whether the machine is capable of migration or not. In the latter case, we could skip all tests that are in the "migration" group ? Thomas
[PATCH] tests/qemu-iotests: Test 157 and 227 require virtio-blk
Tests 157 and 227 use the virtio-blk device, so we have to mark these tests accordingly to be skipped if this devices is not available (e.g. when running the tests with qemu-system-avr only). Signed-off-by: Thomas Huth --- tests/qemu-iotests/157 | 2 ++ tests/qemu-iotests/227 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index 0dc9ba68d2..aa2ebbfb4b 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file +_require_devices virtio-blk + do_run_qemu() { ( diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227 index 7e45a47ac6..eddaad679e 100755 --- a/tests/qemu-iotests/227 +++ b/tests/qemu-iotests/227 @@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file +_require_devices virtio-blk + do_run_qemu() { echo Testing: "$@" -- 2.44.0
Re: [PATCH] aspeed/smc: Only wire flash devices at reset
On 19/03/2024 08.33, Cédric Le Goater wrote: The Aspeed machines have many Static Memory Controllers (SMC), up to 8, which can only drive flash memory devices. Commit 27a2c66c92ec ("aspeed/smc: Wire CS lines at reset") tried to ease the definitions of these devices by allowing flash devices from the command line to be attached to a SSI bus. For that, the wiring of the CS lines of the Aspeed SMC controller was moved at reset. Two assumptions are made though, first that the device has a SSI_GPIO_CS GPIO line, which is not always the case, and second that it is flash device. Correct this problem by ensuring that the devices attached to the bus are the correct flash type. This fixes a QEMU abort when devices without a CS line, such as the max111x, are passed on the command line. While at it, export TYPE_M25P80 used in the Xilinx Versal Virtual machine. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2228 Fixes: 27a2c66c92ec ("aspeed/smc: Wire CS lines at reset") Reported-by: Thomas Huth Signed-off-by: Cédric Le Goater --- Thanks! Reviewed-by: Thomas Huth Tested-by: Thomas Huth
[PATCH 5/9] tests/qemu-iotests: Restrict test 134 and 158 to the 'file' protocol
Commit b25b387fa592 updated the iotests 134 and 158 to use the --image-opts parameter for qemu-io with file protocol related options, but forgot to update the _supported_proto line accordingly. So let's do that now. Fixes: b25b387fa5 ("qcow2: convert QCow2 to use QCryptoBlock for encryption") Signed-off-by: Thomas Huth --- tests/qemu-iotests/134 | 2 +- tests/qemu-iotests/158 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 index ded153c0b9..b2c3c03f08 100755 --- a/tests/qemu-iotests/134 +++ b/tests/qemu-iotests/134 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter _supported_fmt qcow qcow2 -_supported_proto generic +_supported_proto file size=128M diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158 index a95878e4ce..3a9ad7eed0 100755 --- a/tests/qemu-iotests/158 +++ b/tests/qemu-iotests/158 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter _supported_fmt qcow qcow2 -_supported_proto generic +_supported_proto file size=128M -- 2.44.0
[PATCH 9/9] tests/qemu-iotests: Restrict tests using "--blockdev file" to the file protocol
Tests that use "--blockdev" with the "file" driver cannot work with other protocols, so we should mark them accordingly. Signed-off-by: Thomas Huth --- tests/qemu-iotests/tests/qcow2-internal-snapshots | 2 +- tests/qemu-iotests/tests/qsd-jobs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots b/tests/qemu-iotests/tests/qcow2-internal-snapshots index 36523aba06..9f83aa8903 100755 --- a/tests/qemu-iotests/tests/qcow2-internal-snapshots +++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots @@ -39,7 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # This tests qcow2-specific low-level functionality _supported_fmt qcow2 -_supported_proto generic +_supported_proto file # Internal snapshots are (currently) impossible with refcount_bits=1, # and generally impossible with external data files _unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs index 510bf0a9dc..9b843af631 100755 --- a/tests/qemu-iotests/tests/qsd-jobs +++ b/tests/qemu-iotests/tests/qsd-jobs @@ -40,7 +40,7 @@ cd .. . ./common.filter _supported_fmt qcow2 -_supported_proto generic +_supported_proto file size=128M -- 2.44.0