aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-09-30block: use bdrv_is_sg() helper instead of raw bs->sg readingDenis V. Lunev3-4/+4
I believe that if the helper exists, it must be used always for reading of the value. It breaks expectations in the other case. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Fam Zheng <fam@euphon.net> CC: Ronnie Sahlberg <ronniesahlberg@gmail.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Peter Lieven <pl@kamp.de> CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20220817083736.40981-2-den@openvz.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30block: add missed block_acct_setup with new block device init procedureDenis V. Lunev5-5/+92
Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has changed things a lot. 'libvirt' uses it to detect that it should follow new initialization way and this changes things considerably. With this procedure followed, blockdev_init() is not called anymore and thus block_acct_setup() helper is not called. This means in particular that defaults for block accounting statistics are changed and account_invalid/account_failed are actually initialized as false instead of true originally. This commit changes things to match original world. There are the following constraints: * new default value in block_acct_init() is set to true * block_acct_setup() inside blockdev_init() is called before blkconf_apply_backend_options() * thus newly created option in block device properties has precedence if specified Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> CC: Peter Krempa <pkrempa@redhat.com> CC: Markus Armbruster <armbru@redhat.com> CC: John Snow <jsnow@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220824095044.166009-3-den@openvz.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30block: pass OnOffAuto instead of bool to block_acct_setup()Denis V. Lunev3-10/+35
We would have one more place for block_acct_setup() calling, which should not corrupt original value. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> CC: Peter Krempa <pkrempa@redhat.com> CC: Markus Armbruster <armbru@redhat.com> CC: John Snow <jsnow@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> CC: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220824095044.166009-2-den@openvz.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30qemu-img: Wean documentation and help output off '?' for helpMarkus Armbruster2-3/+3
'?' for help is deprecated since commit c8057f951d "Support 'help' as a synonym for '?' in command line options", v1.2.0. We neglected to update output of qemu-img --help and the manual. Do that now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220908130842.641410-1-armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30block/qcow2-bitmap: Add missing cast to silent GCC errorPhilippe Mathieu-Daudé1-1/+1
Commit d1258dd0c8 ("qcow2: autoloading dirty bitmaps") added the set_readonly_helper() GFunc handler, correctly casting the gpointer user_data in both the g_slist_foreach() caller and the handler. Few commits later (commit 1b6b0562db), the handler is reused in qcow2_reopen_bitmaps_rw() but missing the gpointer cast, resulting in the following error when using Homebrew GCC 12.2.0: [2/658] Compiling C object libblock.fa.p/block_qcow2-bitmap.c.o ../../block/qcow2-bitmap.c: In function 'qcow2_reopen_bitmaps_rw': ../../block/qcow2-bitmap.c:1211:60: error: incompatible type for argument 3 of 'g_slist_foreach' 1211 | g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false); | ^~~~~ | | | _Bool In file included from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gmain.h:26, from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/giochannel.h:33, from /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib.h:54, from /Users/philmd/source/qemu/include/glib-compat.h:32, from /Users/philmd/source/qemu/include/qemu/osdep.h:144, from ../../block/qcow2-bitmap.c:28: /opt/homebrew/Cellar/glib/2.72.3_1/include/glib-2.0/glib/gslist.h:127:61: note: expected 'gpointer' {aka 'void *'} but argument is of type '_Bool' 127 | gpointer user_data); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~ At top level: FAILED: libblock.fa.p/block_qcow2-bitmap.c.o Fix by adding the missing gpointer cast. Fixes: 1b6b0562db ("qcow2: support .bdrv_reopen_bitmaps_rw") Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220919182755.51967-1-f4bug@amsat.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-30qcow2: fix memory leak in qcow2_read_extensionslu zhipeng1-0/+1
Free feature_table if it is failed in bdrv_pread. Signed-off-by: lu zhipeng <luzhipeng@cestc.cn> Message-Id: <20220921144515.1166-1-luzhipeng@cestc.cn> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2022-09-28Merge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into ↵Stefan Hajnoczi31-190/+285
staging * Fixes for qtests and unit tests to be more portable to non-POSIX platforms # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMz9MQRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbVUKRAAnubo/wtHqjxg/yVO68odX2LFI2koligA # LcEAnhGkVJ/Pe/+Qo9yVbcOY6k6xfGQU3VIipqvLEwPAdSF0E43EJxlImBNm8/Zq # MggjNoepXRhdFGULONSmSNm7HJykLH/CHdmBjPLrbpkTCwWG1gg64xP9fI+b8mGf # vST0ADuYloLDA9J45UbC33AD+9dQsy2GeOs8X99O6ysKF3htEqMD3vBdqKiJSwgT # 2c7UqySGECn6kMHl7iAdipRNUghSgzpUe8LcH4jP7Y1XnoB3zwC/+VrOVwFESI6y # LVFsC8u7cEKKSYunoowfQTgHvYbCuSdrDqljy17NE5qRMziKMTnhXaQNR5wtBKNt # HZxvc082P/QDFdBYYY3MIjB27r/I6x0t6Xl4IVwLz7bK0xfHFF8Ba2Lr57/2RTc/ # SMPDxGrMicTPnPDU/Cw5VROMmw0OC/tVpJMGo1VjVnNESo581RAMApyzkWiUyfZj # ktKd+4ihmqrBXcZHVjKbIufa6eKNuktlkfv72dnJY4XoUlDHlbDYaVuknybZmxWK # 9/CDVDG72s5Cqm+M47Q56IagVVZwIGrUP0u3j3h/v0rnHZehY8Qzr3SLEfeqmUb6 # nP7MP+ItZFZtMITdvXb3OtyeVuM0ZSw8kt+/evpvC9zB6FjgYl/e5FppsO0HxB/O # PeeV43Bk270= # =n+FM # -----END PGP SIGNATURE----- # gpg: Signature made Wed 28 Sep 2022 03:16:20 EDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu: (37 commits) docs/devel: testing: Document writing portable test cases tests/qtest: boot-serial-test: Close the serial file before starting QEMU tests/qtest: vhost-user-test: Avoid using hardcoded /tmp tests/qtest: qmp-test: Avoid using hardcoded /tmp tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp tests/qtest: hd-geo-test: Avoid using hardcoded /tmp tests/x86: Move common code to function in device-plug-test .gitlab-ci.d/windows.yml: Display meson test logs tests/qtest: migration-test: Skip running some TLS cases for win32 tests/qtest: libqtest: Replace the call to close a socket with closesocket() tests/qtest: microbit-test: Fix socket access for win32 tests/qtest: virtio-net-failover: Disable migration tests for win32 tests/qtest: ide-test: Open file in binary mode tests/qtest: migration-test: Disable IO redirection for win32 tests/qtest: bios-tables-test: Adapt the case for win32 tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32 tests/qtest: libqtest: Exclude the *_fds APIs for win32 tests/qtest: libqtest: Adapt global_qtest declaration for win32 tests/qtest: qmp-test: Skip running test_qmp_oob for win32 tests/qtest: Build test-filter-{mirror, redirector} cases for posix only ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-09-28Merge tag 'linux-user-for-7.2-pull-request' of ↵Stefan Hajnoczi43-262/+797
https://gitlab.com/laurent_vivier/qemu into staging linux-user pull request 20220928-v2 use 'max' instead of 'qemu32' / 'qemu64' add pidfd_open(), pidfd_send_signal() and pidfd_getfd() Improve madvise(MADV_DONTNEED) futex syscal rework strace improvement HP/PA fixes and improvement Misc fixes # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmM0riISHGxhdXJlbnRA # dml2aWVyLmV1AAoJEPMMOL0/L748gH4P/2wesXJKPMY2zQzP3Rld4iyefoPGG/Yp # mdq59BbjO2jQMR8GBss/nl9l84cIzzkYRQIogaKsjljtZYm/OO5xRefqrzJY6apD # eidxv20dAVjuaXHAIdGhbFlxot1ctExbZs9atB4uj5DWxfYGD6e/stoBy5/pSmr4 # M5EbGHhyrRI7tRbHGtVQVvG6AT6XGE0pT9tzT5JLaApF8UPMkgJwmez16PNWvcMm # v8GEvKm/vEVS8CCpzLV4kfwVeo3f54VAOrEBDi29ph2Yo50IA21k8BvoRZaSp+Kn # G6TMnnly/DkMspAs5EOVfat+kv3TziNNdDH7EnVU1vV1yTDdZgW/1204Uy/JY0Pw # WotwAFuO9FYeHKmjY0CfnIIZZHYZpDYUOZ8M6dESD/O0EjoB8LMf5p9cbYlze4DE # csJZCsVcz19HDv6QZXi5mvvDcJ83B2IDb8/PUAzSc0n62lXL9qjYD0wdb0QsLdAT # I25qLDge1HCmQfCIKcaoHYvE0pDmvkF6ftuQUXLtIwtaV0Z/N5wDf2PEHikjOYHM # gD2izz23/2wQx6KP/9ZNnCJ5QEBkEgm5wpHncsvjzSzi1uIdNlHyzJJwGTAcc5qZ # hOeoJ7dT0D6g0BGnvOdg2W/bDx18KW65mNDxE4d+W0uzn0YmQtArk2YsnhKQNO46 # 12/0ltPFnSV/ # =DIzQ # -----END PGP SIGNATURE----- # gpg: Signature made Wed 28 Sep 2022 16:27:14 EDT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * tag 'linux-user-for-7.2-pull-request' of https://gitlab.com/laurent_vivier/qemu: (37 commits) linux-user: Add parameters of getrandom() syscall for strace linux-user: Lock log around strace linux-user: Update print_futex_op linux-user: Implement PI futexes linux-user: Convert signal number for FUTEX_FD linux-user: Implement FUTEX_WAKE_BITSET linux-user: Sink call to do_safe_futex linux-user: Combine do_futex and do_futex_time64 linux-user: Set ELF_BASE_PLATFORM for MIPS linux-user: Introduce stubs for ELF AT_BASE_PLATFORM linux-user/s390x: Save/restore fpc when handling a signal linux-user: Don't assume 0 is not a valid host timer_t value linux-user: fix bug about missing signum convert of sigqueue linux-user/hppa: Fix setup_sigcontext() linux-user/hppa: Allow PROT_GROWSUP and PROT_GROWSDOWN in mprotect() linux-user/hppa: Increase guest stack size to 80MB for hppa target linux-user/hppa: Drop stack guard page on hppa target linux-user/hppa: Add signal trampoline for hppa target linux-user: Add proper strace format strings for getdents()/getdents64() linux-user: Fix TARGET_PROT_SEM for XTENSA ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-09-28Merge tag 'vfio-updates-20220927.1' of ↵Stefan Hajnoczi2-17/+21
https://gitlab.com/alex.williamson/qemu into staging VFIO updates 2022-09-27 * Fix initial values for migration state (Kunkun Jiang) * Fix a use-after-free error path (Alex Williamson) # -----BEGIN PGP SIGNATURE----- # # iQJPBAABCAA5FiEEQvbATlQL0amee4qQI5ubbjuwiyIFAmMzXKwbHGFsZXgud2ls # bGlhbXNvbkByZWRoYXQuY29tAAoJECObm247sIsiOv8QAKJstXXq92FxT+wBXt0Q # wnMJjE1hvCHXki7FfPSRPmVgoMppWD1vhr7TajeOkidtqnX48V863/RGZfxX+oQU # bEPPT6QaWnYhagslrRjIj4R+5O5N6rY9A2zzpG2vv1x9qv8r9WLicKvwjzinTgAp # PyU9Ajgu2OUpD6O64iXIeD2MnfblSN3N+bBvZ7alDifFC1D8CfX9D3X76bdERC6X # LFEenZ/3ZwZh46z1xv4v3opI2aBp9oh1gca9NKc/jUKg11AuswhmmUSmb+lVDDnt # UBNTqgHtnGBfAMcxQ1cA6AtRvtwwneJkQC4nkUmOEWuMImUEhTQw7vcTpDFFyHzz # dcYRjioHu15EmuHeP/W+139fnGeCDpr1/XJcJ2avUp/9oNeRDsAi4w/lEHXHv5Rm # KHuXSIswC/6+dgvdOwRw2OlbzX5KjSVlqXJia+QexEliCxpcs8OYEJ7ZgRdFCO8t # unWssLs7x1O40J7cngnyT8addLGwbwExrJggpG70suSQB5mMIJzNIVanUpUkzy2g # 9kAwW3fTUXqW7O+2RYbjFUoY0yR1eHO8EExiPHyO3hxCDNjglwpM20C4M7fs3Eo6 # /1zwagtjxblsWTPK9dOsq3y4yoXlhX+0EpM9PYPV8OleayTRyhS7O/FzHmqpJNlt # G524RusuIU+xNwUTEKgFFHgm # =5YPM # -----END PGP SIGNATURE----- # gpg: Signature made Tue 27 Sep 2022 16:27:24 EDT # gpg: using RSA key 42F6C04E540BD1A99E7B8A90239B9B6E3BB08B22 # gpg: issuer "alex.williamson@redhat.com" # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full] # gpg: aka "Alex Williamson <alex@shazbot.org>" [full] # gpg: aka "Alex Williamson <alwillia@redhat.com>" [full] # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" [full] # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * tag 'vfio-updates-20220927.1' of https://gitlab.com/alex.williamson/qemu: vfio/common: Fix vfio_iommu_type1_info use after free vfio/migration: Fix incorrect initialization value for parameters in VFIOMigration Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-09-28Merge tag 'pull-xen-20220927' of ↵Stefan Hajnoczi1-2/+2
https://xenbits.xen.org/git-http/people/aperard/qemu-dm into staging Xen patch - Xen PCI passthrough fix for Atomic Ops requests # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEE+AwAYwjiLP2KkueYDPVXL9f7Va8FAmMy/BUACgkQDPVXL9f7 # Va/EWwf+OYEesPbMD9IWvMAgtbuqK8Q/u+YwX8bviiWsBHdGT/Egut/AKBcdmVo0 # 68erlvsXBlffhT5kw6FtWHPrIMsDA+tos/q4pM7w4IJUsz+RKV/1IYT1pQ92XPP1 # RgxJyMCmVrKadqnDvVE9wAn8NeK3t75Lq5QWhN4cpWDWSSUXta90dlu8QefnrguA # tTmdgneoDUjBhimpy4LgoWBeBqnAMdN05A0dcGcsTSjptj/GsylwSbbbkGivsaDl # OH23Lk4I6dBhqGo0bEi/LpuPZ44BsuY6NHUlZixbWZl+PxneePdiEd+6YjEWNAZU # kx2XEm0hQXYxUZDk+fvHCVZP3Y/b1g== # =cDzP # -----END PGP SIGNATURE----- # gpg: Signature made Tue 27 Sep 2022 09:35:17 EDT # gpg: using RSA key F80C006308E22CFD8A92E7980CF5572FD7FB55AF # gpg: Can't check signature: No public key * tag 'pull-xen-20220927' of https://xenbits.xen.org/git-http/people/aperard/qemu-dm: hw/xen: set pci Atomic Ops requests for passthrough device Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-09-28linux-user: Add parameters of getrandom() syscall for straceHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220927093538.8954-2-deller@gmx.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2022-09-27vfio/common: Fix vfio_iommu_type1_info use after freeAlex Williamson1-17/+19
On error, vfio_get_iommu_info() frees and clears *info, but vfio_connect_container() continues to use the pointer regardless of the return value. Restructure the code such that a failure of this function triggers an error and clean up the remainder of the function, including updating an outdated comment that had drifted from its relevant line of code and using host page size for a default for better compatibility on non-4KB systems. Reported-by: Nicolin Chen <nicolinc@nvidia.com> Link: https://lore.kernel.org/all/20220910004245.2878-1-nicolinc@nvidia.com/ Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Link: https://lore.kernel.org/r/166326219630.3388898.12882473157184946072.stgit@omen Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2022-09-27vfio/migration: Fix incorrect initialization value for parameters in ↵Kunkun Jiang1-0/+2
VFIOMigration The structure VFIOMigration of a VFIODevice is allocated and initialized in vfio_migration_init(). "device_state" and "vm_running" are initialized to 0, indicating that VFIO device is_STOP and VM is not-running. The initialization value is incorrect. According to the agreement, default state of VFIO device is _RUNNING. And if a VFIO device is hot-plugged while the VM is running, "vm_running" should be 1. This patch fixes it. Fixes: 02a7e71b1e5b ("vfio: Add VM state change handler to know state of VM") Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com> Link: https://lore.kernel.org/r/20220711014651.1327-1-jiangkunkun@huawei.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2022-09-27docs/devel: testing: Document writing portable test casesBin Meng1-0/+30
Update the best practices of how to write portable test cases that can be built and run successfully on both Linux and Windows hosts. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220927110632.1973965-55-bmeng.cn@gmail.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: boot-serial-test: Close the serial file before starting QEMUBin Meng1-0/+3
This qtest executable created a serial chardev file to be passed to the QEMU executable. The serial file was created by g_file_open_tmp(), which internally opens the file with FILE_SHARE_WRITE security attribute on Windows. Based on [1], there is only one case that allows the first call to CreateFile() with GENERIC_READ & FILE_SHARE_WRITE, and second call to CreateFile() with GENERIC_WRITE & FILE_SHARE_READ. All other combinations require FILE_SHARE_WRITE in the second call. But there is no way for the second call (in this case the QEMU executable) to know what combination was passed to the first call, unless FILE_SHARE_WRITE is passed to the second call. Two processes shouldn't share the same file for writing with a chardev. Let's close the serial file before starting QEMU. [1] https://docs.microsoft.com/en-us/windows/win32/fileio/creating-and-opening-files Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-40-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: vhost-user-test: Avoid using hardcoded /tmpBin Meng1-4/+6
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-19-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: qmp-test: Avoid using hardcoded /tmpBin Meng1-4/+6
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-17-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmpBin Meng1-8/+7
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-16-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: hd-geo-test: Avoid using hardcoded /tmpBin Meng1-13/+11
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-13-bmeng.cn@gmail.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/x86: Move common code to function in device-plug-testMichael Labiuk1-25/+17
Move common code for device removing to function. Signed-off-by: Michael Labiuk <michael.labiuk@virtuozzo.com> Message-Id: <20220920104842.605530-2-michael.labiuk@virtuozzo.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27.gitlab-ci.d/windows.yml: Display meson test logsBin Meng1-2/+2
When CI fails we don't know what causes the failure. Displaying the meson test logs can be helpful. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-53-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: migration-test: Skip running some TLS cases for win32Bin Meng1-0/+14
Some migration test cases use TLS to communicate, but they fail on Windows with the following error messages: qemu-system-x86_64: TLS handshake failed: Insufficient credentials for that request. qemu-system-x86_64: TLS handshake failed: Error in the pull function. query-migrate shows failed migration: TLS handshake failed: Error in the pull function. Disable them temporarily. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220925113032.1949844-51-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: libqtest: Replace the call to close a socket with closesocket()Bin Meng1-4/+4
close() is a *nix function. It works on any file descriptor, and sockets in *nix are an example of a file descriptor. closesocket() is a Windows-specific function, which works only specifically with sockets. Sockets on Windows do not use *nix-style file descriptors, and socket() returns a handle to a kernel object instead, so it must be closed with closesocket(). In QEMU there is already a logic to handle such platform difference in os-posix.h and os-win32.h, that: * closesocket maps to close on POSIX * closesocket maps to a wrapper that calls the real closesocket() on Windows Replace the call to close a socket with closesocket() instead. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-46-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: microbit-test: Fix socket access for win32Bin Meng1-5/+5
Sockets on Windows do not use *nix-style file descriptors, so write()/read()/close() do not work on Windows. Switch over to use send()/recv()/closesocket() which work with sockets on all platforms. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-45-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: virtio-net-failover: Disable migration tests for win32Xuzhou Cheng1-1/+8
These tests use the exec migration protocol, which is unsupported on Windows as of today. Disable these tests for now. Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com> Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-42-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: ide-test: Open file in binary modeXuzhou Cheng1-2/+2
By default Windows opens file in text mode, while a POSIX compliant implementation treats text files and binary files the same. The fopen() 'mode' string can include the letter 'b' to indicate binary mode shall be used. POSIX spec says the character 'b' shall have no effect, but is allowed for ISO C standard conformance. Let's add the letter 'b' which works on both POSIX and Windows. Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com> Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-41-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: migration-test: Disable IO redirection for win32Bin Meng1-0/+9
On Windows the QEMU executable is created via CreateProcess() and IO redirection does not work, so don't bother adding IO redirection to the command line. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-40-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: bios-tables-test: Adapt the case for win32Bin Meng1-3/+9
Single quotes in the arguments (oem_id='CRASH ') are not removed in the Windows environment before it is passed to the QEMU executable. The space in the argument causes the "-acpitable" option parser to think that all of its parameters are done, hence it complains: '-acpitable' requires one of 'data' or 'file' Change to use double quotes which works fine on all platforms. Also /dev/null does not work on win32, and nul should be used. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20220925113032.1949844-39-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32Bin Meng2-5/+36
These test cases uses "blkdebug:path/to/config:path/to/image" for testing. On Windows, absolute file paths contain the delimiter ':' which causes the blkdebug filename parser fail to parse filenames. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-38-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: libqtest: Exclude the *_fds APIs for win32Bin Meng2-1/+17
libqmp.c::qmp_fd_vsend_fds() is not available on Windows, hence any APIs in libqtest that call libqmp.c::qmp_fd_vsend_fds() should be excluded for win32 too. This includes the following: * qtest_qmp_vsend_fds() * qtest_vqmp_fds() * qtest_qmp_fds() * qtest_qmp_add_client() Note qtest_qmp_vsend() was wrongly written to call qmp_fd_vsend_fds() previously, but it should call the non fds version API qmp_fd_vsend(). Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-35-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: libqtest: Adapt global_qtest declaration for win32Xuzhou Cheng1-0/+4
Commit dd2107497275 ("tests/libqtest: Use libqtest-single.h in tests that require global_qtest") moved global_qtest to libqtest-single.h, by declaring global_qtest attribute to be common and weak. This trick unfortunately does not work on Windows, and building qtest test cases results in multiple definition errors of the weak symbol global_qtest, as Windows PE does not have the concept of the so-called weak symbol like ELF in the *nix world. However Windows does provide a trick to declare a variable to be a common symbol, via __declspec(selectany) [1]. It does not provide the "strong override weak" effect but we don't need it in our use case anyway. So let's use it for win32. [1] https://docs.microsoft.com/en-us/cpp/cpp/selectany Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com> Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-33-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: qmp-test: Skip running test_qmp_oob for win32Bin Meng1-0/+7
The test_qmp_oob test case calls mkfifo() which does not exist on win32. Exclude it. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-31-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: Build test-filter-{mirror, redirector} cases for posix onlyBin Meng1-20/+16
The test-filter-{mirror,redirector} cases use socketpair() API that is only available on POSIX and should only be built for POSIX. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-30-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: Skip running virtio-net-test cases that require socketpair() ↵Bin Meng1-7/+6
for win32 Some of the virtio-net-test test cases require socketpair() to do the test setup. Skip them for win32. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-29-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests: vhost-user-bridge: Avoid using hardcoded /tmpBin Meng1-2/+1
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-25-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/unit: test-qga: Avoid using hardcoded /tmpBin Meng1-1/+1
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-24-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/unit: test-image-locking: Avoid using hardcoded /tmpBin Meng1-4/+4
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-23-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: libqtest: Avoid using hardcoded /tmpBin Meng1-4/+8
The qtest library was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() and g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-22-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: virtio-scsi-test: Avoid using hardcoded /tmpBin Meng1-2/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-21-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: virtio-blk-test: Avoid using hardcoded /tmpBin Meng1-2/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-20-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: vhost-user-blk-test: Avoid using hardcoded /tmpBin Meng1-1/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_get_tmp_dir() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-18-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: ide-test: Avoid using hardcoded /tmpBin Meng1-4/+6
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-14-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: virtio_blk_fuzz: Avoid using hardcoded /tmpBin Meng1-2/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-12-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: generic_fuzz: Avoid using hardcoded /tmpBin Meng1-2/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-11-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: fdc-test: Avoid using hardcoded /tmpBin Meng1-2/+3
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-10-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: cxl-test: Avoid using hardcoded /tmpBin Meng1-9/+6
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220925113032.1949844-9-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: boot-serial-test: Avoid using hardcoded /tmpBin Meng1-4/+4
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-8-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: aspeed_smc-test: Avoid using hardcoded /tmpBin Meng1-3/+2
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220925113032.1949844-7-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: ahci-test: Avoid using hardcoded /tmpBin Meng1-8/+11
This case was written to use hardcoded /tmp directory for temporary files. Update to use g_file_open_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-6-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-09-27tests/qtest: i440fx-test: Rewrite create_blob_file() to be portableBin Meng1-40/+14
Previously request_{bios, pflash} cases were skipped on win32, mainly due to create_blob_file() calling mmap() which does not exist on win32. This rewirtes create_blob_file() to be portable, so that we can enable these cases on Windows. Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220925113032.1949844-2-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>