summaryrefslogtreecommitdiffstats
path: root/qga
Commit message (Collapse)AuthorAgeFilesLines
* Fix some typos in documentation and commentsStefan Weil2022-11-051-1/+1
| | | | | | | | | | | Most of them were found and fixed using codespell. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20221030105944.311940-1-sw@weilnetz.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* qga: add channel path to error messagesBjørn Forsman2022-10-261-2/+2
| | | | | | | | | | | | | It's useful to know which device was used if/when it fails. channel-win32.c had this since 2015, with c69403fcd4a0cb89f838a212ab71e4a1a3464c95 ("qemu-ga: debug printouts to help troubleshoot installation"), this brings channel-posix.c up to speed. Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Add HW address getting for FreeBSDAlexander Ivanov2022-10-261-0/+15
| | | | | | | | | | Replace a dumb function in commands-bsd.c by the code of HW address getting. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Move HW address getting to a separate functionAlexander Ivanov2022-10-263-42/+78
| | | | | | | | | | | In the next patch FreeBSD support for guest-network-get-interfaces will be added. Previously move Linux-specific code of HW address getting to a separate functions and add a dumb function to commands-bsd.c. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Add support for user password setting in FreeBSDAlexander Ivanov2022-10-261-10/+25
| | | | | | | | | | | Move qmp_guest_set_user_password() from __linux__ condition to (__linux__ || __FreeBSD__) condition. Add command and arguments for password setting in FreeBSD. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Add shutdown/halt/reboot support for FreeBSDAlexander Ivanov2022-10-261-0/+7
| | | | | | | | | | Add appropriate shutdown command arguments to qmp_guest_shutdown() for FreeBSD. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Add UFS freeze/thaw support for FreeBSDAlexander Ivanov2022-10-265-164/+334
| | | | | | | | | | | | UFS supports FS freezing through ioctl UFSSUSPEND on /dev/ufssuspend. Frozen FS can be thawed by closing /dev/ufssuspend file descriptior. Use getmntinfo to get a list of mounted FS. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Move Linux-specific FS freeze/thaw code to a separate fileAlexander Ivanov2022-10-264-272/+338
| | | | | | | | | | | | | In the next patches we are going to add FreeBSD support for QEMU Guest Agent. In the result, code in commands-posix.c will be too cumbersome. Move Linux-specific FS freeze/thaw code to a separate file commands-linux.c keeping common POSIX code in commands-posix.c. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: Add initial FreeBSD supportAlexander Ivanov2022-10-263-1/+32
| | | | | | | | | | | - Fix device path. - Fix virtio-serial channel initialization. - Make the code buildable in FreeBSD. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* meson: require 0.61.3Paolo Bonzini2022-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | This removes the dependency of dbus-display on --enable-modules. It also allows cleanups in modinfo collection and allows moving C++ compiler detection to meson.build. Because it is now deprecated to use install_subdir to create an empty directory, replace it with install_emptydir. Updating the Meson submodule to 0.61.5 also removes the message WARNING: Broken python installation detected. Python files installed by Meson might not be found by python interpreter. unless using system meson is forced with --meson. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/873 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/848 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga: Replace 'blacklist' and 'whitelist' in the guest agent sourcesThomas Huth2022-09-205-45/+46
| | | | | | | | | Let's use better, more inclusive wording here. Message-Id: <20220727092135.302915-3-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* qga: Replace 'blacklist' command line and config file options by 'block-rpcs'Thomas Huth2022-09-201-5/+13
| | | | | | | | | | | | | | | | | | | Let's use a more appropriate wording for this command line and config file option. The old ones are still accepted for compatibility reasons, but marked as deprecated now so that it could be removed in a future version of QEMU. This change is based on earlier patches from Philippe Mathieu-Daudé, with the idea for the new option name suggested by BALATON Zoltan. And while we're at it, replace the "?" in the help text with "help" since that does not have the problem of conflicting with the wildcard character of the shells. Message-Id: <20220727092135.302915-2-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* qga: treat get-guest-fsinfo as "best effort"John Snow2022-07-181-1/+9
| | | | | | | | | | | | | | | | | | In some container environments, there may be references to block devices witnessable from a container through /proc/self/mountinfo that reference devices we simply don't have access to in the container, and cannot provide information about. Instead of failing the entire fsinfo command, return stub information for these failed lookups. This allows test-qga to pass under docker tests, which are in turn used by the CentOS VM tests. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220708153503.18864-2-jsnow@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* Merge tag 'qga-win32-pull-2022-07-13' of github.com:kostyanf14/qemu into stagingPeter Maydell2022-07-143-0/+176
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qga-win32-pull-2022-07-13 # gpg: Signature made Wed 13 Jul 2022 11:13:32 BST # gpg: using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7 # gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: C2C2 C109 EA43 C63C 1423 EB84 EF5D 5E81 61BA 84E7 * tag 'qga-win32-pull-2022-07-13' of github.com:kostyanf14/qemu: qga: add command 'guest-get-cpustats' qapi: Avoid generating C identifier 'linux' MAINTAINERS: Add myself as Guest Agent reviewer Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * qga: add command 'guest-get-cpustats'zhenwei pi2022-07-133-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A vCPU thread always reaches 100% utilization when: - guest uses idle=poll - disable HLT vm-exit - enable MWAIT Add new guest agent command 'guest-get-cpustats' to get guest CPU statistics, we can know the guest workload and how busy the CPU is. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20220707005602.696557-3-pizhenwei@bytedance.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* | qga: Relocate a path emitted in the help textAkihiko Odaki2022-07-081-1/+5
|/ | | | | | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Message-Id: <20220624145455.50058-1-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* meson: qga: do not use deprecated meson.build_root()Paolo Bonzini2022-06-061-1/+1
| | | | | | | | | The function will return the build root of the parent project if called from a subproject; that is irrelevant for QEMU's usage but rarely desirable, and therefore the function was deprecated and replaced by two functions project_build_root() and global_build_root(). Replace it with the former. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga/wixl: replace QEMU_GA_MSI_MINGW_BIN_PATH with glib bindirMarc-André Lureau2022-05-282-13/+13
| | | | | | | | | Use more conventional variables to set the location of pre-built DLL/bin. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-15-marcandre.lureau@redhat.com>
* qga/wixl: simplify some pre-processingMarc-André Lureau2022-05-281-13/+7Star
| | | | | | | | Sadly, wixl doesn't have 'elif'. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-14-marcandre.lureau@redhat.com>
* qga/wixl: require Mingw_binMarc-André Lureau2022-05-281-9/+0Star
| | | | | | | | No clear reason to make guesses here. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-13-marcandre.lureau@redhat.com>
* qga/wixl: prefer variables over environmentMarc-André Lureau2022-05-282-26/+13Star
| | | | | | | | | No need to setup an environment or to check if the variable is undefined manually. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-12-marcandre.lureau@redhat.com>
* qga: make build_fs_mount_list() return a boolMarc-André Lureau2022-05-281-15/+10Star
| | | | | | | | | Change build_fs_mount_list() to return bool, in accordance with the guidance under = Rules = in include/qapi/error.h Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Suggested-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220525144140.591926-10-marcandre.lureau@redhat.com>
* qga: replace qemu_open_old() with qga_open_cloexec()Marc-André Lureau2022-05-282-8/+13
| | | | | | | | | | | | | qemu_open_old() uses qemu_open_internal() which handles special "/dev/fdset/" path for monitor fd sets, set CLOEXEC, and uses Error reporting (and some O_DIRECT special error casing). The monitor fdset handling is unnecessary for qga, use qga_open_cloexec() instead. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-9-marcandre.lureau@redhat.com>
* qga: throw an Error in ga_channel_open()Marc-André Lureau2022-05-281-25/+17Star
| | | | | | | | Allow for a single point of error reporting, and further refactoring. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220525144140.591926-8-marcandre.lureau@redhat.com>
* qga: use qga_open_cloexec() for safe_open_or_create()Marc-André Lureau2022-05-281-4/+3Star
| | | | | | | | The function takes care of setting CLOEXEC. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220525144140.591926-7-marcandre.lureau@redhat.com>
* qga: add qga_open_cloexec() helperMarc-André Lureau2022-05-283-0/+42
| | | | | | | | | | | | | QGA calls qemu_open_old() in various places. Calling qemu_open() instead isn't a great alternative, as it has special "/dev/fdset" handling and depends on QEMU internal monitor data structures. Instead, provide a simple helper for QGA needs, with Error* support. The following patches will make use of it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220525144140.591926-6-marcandre.lureau@redhat.com>
* qga: flatten safe_open_or_create()Marc-André Lureau2022-05-281-60/+60
| | | | | | | | | | | There is a bit too much nesting in the function, this can be simplified a bit to improve readability. This also helps with the following error handling changes. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220525144140.591926-5-marcandre.lureau@redhat.com>
* qga-win32: Add support for NVME bus typeKonstantin Kostiuk2022-05-251-0/+5
| | | | | | | | | | Bus type spaces (Indicates a storage spaces bus) is not supported, so return it as unknown. Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220524154344.869638-2-kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* trivial: qga: Log version on startKonstantin Kostiuk2022-05-251-0/+2
| | | | | | | Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220523191644.823726-2-kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* qga: add guest-get-diskstats command for Linux guestsluzhipeng2022-05-253-0/+215
| | | | | | | | | | | | Add a new 'guest-get-diskstats' command for report disk io statistics for Linux guests. This can be useful for getting io flow or handling IO fault, no need to enter guests. Signed-off-by: luzhipeng <luzhipeng@cestc.cn> Message-Id: <20220520021935.676-1-luzhipeng@cestc.cn> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
* Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into stagingRichard Henderson2022-05-162-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix WHPX debugging * misc qga-vss fixes * remove the deprecated CPU model 'Icelake-Client' * support for x86 architectural LBR * remove deprecated properties * replace deprecated -soundhw with -audio # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmJ/hZ4UHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroN2Igf/bFs+yluOikt0eFNmXYnshrGBWPXr # oam0iumPox34vTzZnjpSjF6tJGxHWOgi+wbgIvbwOYHA/ONxx8akW580j+1VhEWa # X29VyUzjZBffgFtmlF4fM74/ELYm7s4c1a1/D9TpVP6Dr0fSWbMujbx4dfeVstvf # sONN+A8sVxaNdV9QKPE6BvqfMlPLoCiigrOetf6iY1KuUtkQDF8xDB0MdzdutqAQ # szAtQ0rrzjxDx9EuGN1SECFM1/riDUbtOOoA9g2C7gGKrx3/iUc6pzrkIcAfWLFK # xXbH7+6Wynia0cbUxnrvRdY4daMIxm4N3wUvN7szXgF9kxYxeQcsdgGsNA== # =n4lu # -----END PGP SIGNATURE----- # gpg: Signature made Sat 14 May 2022 03:34:06 AM PDT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [undefined] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (23 commits) configure: remove duplicate help messages configure: remove another dead variable build: remove useless dependency introduce -audio as a replacement for -soundhw soundhw: move help handling to vl.c soundhw: unify initialization for ISA and PCI soundhw soundhw: extract soundhw help to a separate function soundhw: remove ability to create multiple soundcards rng: make opened property read-only crypto: make loaded property read-only target/i386: Support Arch LBR in CPUID enumeration target/i386: introduce helper to access supported CPUID target/i386: Enable Arch LBR migration states in vmstate target/i386: Add MSR access interface for Arch LBR target/i386: Add XSAVES support for Arch LBR target/i386: Enable support for XSAVES based features target/i386: Add kvm_get_one_msr helper target/i386: Add lbr-fmt vPMU option to support guest LBR qdev-properties: Add a new macro with bitmask check for uint64_t property i386/cpu: Remove the deprecated cpu model 'Icelake-Client' ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
| * qga-vss: Use the proper operator to free memoryKonstantin Kostiuk2022-05-141-2/+2
| | | | | | | | | | | | | | | | | | volume_name_wchar is allocated by 'void* operator new [](long long unsigned int) Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220512154909.331481-1-kkostiuk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * qga-vss: Add auto generated headers to dependenciesKonstantin Kostiuk2022-05-141-1/+1
| | | | | | | | | | | | Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220512154906.331399-1-kkostiuk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | qapi: Fix malformed "Since:" section tagsMarkus Armbruster2022-05-161-1/+1
|/ | | | | | | | | | "Since X.Y" is not recognized as a tagged section, and therefore not formatted as such in generated documentation. Fix by adding the required colon. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220422132807.1704411-1-armbru@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* qga-vss: always build qga-vss.tlb when qga-vss.dll is builtKonstantin Kostiuk2022-05-071-2/+2
| | | | | | | Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220428181541.300619-1-kkostiuk@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga: Introduce disk smartzhenwei pi2022-05-042-1/+125
| | | | | | | | | | | | | | | | | After assigning a NVMe/SCSI controller to guest by VFIO, we lose everything on the host side. A guest uses these devices exclusively, we usually don't care the actions on these devices. But there is a low probability that hitting physical hardware warning, we need a chance to get the basic smart log info. Introduce disk smart, and implement NVMe smart on linux. Thanks to Keith and Marc-André. CC: Keith Busch <kbusch@kernel.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20220420022610.418052-3-pizhenwei@bytedance.com>
* qga: Introduce NVMe disk bus typezhenwei pi2022-05-042-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assigning a NVMe disk by VFIO or emulating a NVMe controller by QEMU, a NVMe disk get exposed in guest side. Support NVMe disk bus type and implement posix version. Test PCI passthrough case: ~#virsh qemu-agent-command buster '{"execute":"guest-get-disks"}' | jq ... { "name": "/dev/nvme0n1", "dependencies": [], "partition": false, "address": { "serial": "SAMSUNG MZQL23T8HCLS-00A07_S64HNE0N500076", "bus-type": "nvme", "bus": 0, "unit": 0, "pci-controller": { "bus": 0, "slot": 22, "domain": 0, "function": 0 }, "dev": "/dev/nvme0n1", "target": 0 } ... Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Message-Id: <20220420022610.418052-2-pizhenwei@bytedance.com>
* qga/commands-posix: 'guest-shutdown' for SolarisAndrew Deason2022-05-041-3/+18
| | | | | | | | | | | | | | On Solaris, instead of the -P, -H, and -r flags, we need to provide the target init state to the 'shutdown' command: state 5 is poweroff, 0 is halt, and 6 is reboot. We also need to pass -g0 to avoid the default 60-second delay, and -y to avoid a confirmation prompt. Implement this logic under an #ifdef CONFIG_SOLARIS, so the 'guest-shutdown' command works properly on Solaris. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220426195526.7699-6-adeason@sinenomine.net>
* qga/commands-posix: Log all net stats failuresAndrew Deason2022-05-041-1/+5
| | | | | | | | | | guest_get_network_stats can silently fail in a couple of ways. Add debug messages to these cases, so we're never completely silent on failure. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220426195526.7699-5-adeason@sinenomine.net>
* qga/commands-posix: Fix listing ifaces for SolarisAndrew Deason2022-05-041-1/+6
| | | | | | | | | | | | | | | | The code for guest-network-get-interfaces needs a couple of small adjustments for Solaris: - The results from SIOCGIFHWADDR are documented as being in ifr_addr, not ifr_hwaddr (ifr_hwaddr doesn't exist on Solaris). - The implementation of guest_get_network_stats is Linux-specific, so hide it under #ifdef CONFIG_LINUX. On non-Linux, we just won't provide network interface stats. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <20220426195526.7699-4-adeason@sinenomine.net>
* qga/commands-posix: Fix iface hw address detectionAndrew Deason2022-05-041-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since its introduction in commit 3424fc9f16a1 ("qemu-ga: add guest-network-get-interfaces command"), guest-network-get-interfaces seems to check if a given interface has a hardware address by checking 'ifa->ifa_flags & SIOCGIFHWADDR'. But ifa_flags is a field for IFF_* flags (IFF_UP, IFF_LOOPBACK, etc), and comparing it to an ioctl like SIOCGIFHWADDR doesn't make sense. On Linux, this isn't a big deal, since SIOCGIFHWADDR has so many bits set (0x8927), 'ifa->ifa_flags & SIOCGIFHWADDR' will usually have a nonzero result for any 'normal'-looking interfaces: anything with IFF_UP (0x1) or IFF_BROADCAST (0x2) set, as well as several less-common flags. This means we'll try to get the hardware address for most/all interfaces, even those that don't really have one (like the loopback device). For those interfaces, Linux just returns a hardware address of all zeroes. On Solaris, however, trying to get the hardware address for a loopback device returns an EADDRNOTAVAIL error. This causes us to return an error and the entire guest-network-get-interfaces call fails. Change this logic to always try to get the hardware address for each interface, and don't return an error if we fail to get it. Instead, just don't include the 'hardware-address' field in the result if we can't get the hardware address. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <20220426195526.7699-3-adeason@sinenomine.net>
* qga/commands-posix: Use getifaddrs when availableAndrew Deason2022-05-041-229/+245
| | | | | | | | | | | | | | | | | | | Currently, commands-posix.c assumes that getifaddrs() is only available on Linux, and so the related guest agent command guest-network-get-interfaces is only implemented for #ifdef __linux__. This function does exist on other platforms, though, such as Solaris. So, add a meson check for getifaddrs(), and move the code for guest-network-get-interfaces to be built whenever getifaddrs() is available. The implementation for guest-network-get-interfaces still has some Linux-specific code, which is not fixed in this commit. This commit moves the relevant big chunks of code around without changing them, so a future commit can change the code in place. Signed-off-by: Andrew Deason <adeason@sinenomine.net> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <20220426195526.7699-2-adeason@sinenomine.net>
* util: rename qemu_*block() socket functionsMarc-André Lureau2022-05-031-1/+1
| | | | | | | | | | | | | | | | | | The qemu_*block() functions are meant to be be used with sockets (the win32 implementation expects SOCKET) Over time, those functions where used with Win32 SOCKET or file-descriptors interchangeably. But for portability, they must only be used with socket-like file-descriptors. FDs can use g_unix_set_fd_nonblocking() instead. Rename the functions with "socket" in the name to prevent bad usages. This is effectively reverting commit f9e8cacc5557e43 ("oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()"). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
* qga: replace qemu_set_nonblock()Marc-André Lureau2022-05-031-1/+5
| | | | | | | | | The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* qga: replace pipe() with g_unix_open_pipe(CLOEXEC)Marc-André Lureau2022-05-031-1/+1
| | | | | | Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* qga: wixl: get path to sysroot from pkg-config as intendedPaolo Bonzini2022-04-281-1/+1
| | | | | | | | The .wxs file uses $(var.Mingw_bin) while configure/meson have always used Mingw_dlls. Fix them to match what was probably intended. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qga: use fixed-length and GDateTime for log timestampMarc-André Lureau2022-04-211-5/+3Star
| | | | | | | | | | | | | The old code is kind of wrong. Say it's 1649309843.000001 seconds past the epoch. Prints "1649309843.1". 9us later, it prints "1649309843.10". Should really use %06lu for the microseconds part. Use GDateTime instead, as suggested by Daniel. Suggested-by: Markus Armbruster <armbru@redhat.com> Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* qga: remove need for QEMU atomic.hMarc-André Lureau2022-04-211-7/+5Star
| | | | | | | | | | | | Since the introduction of guest-exec in/out/err redirections in commit a1853dca74 ("qga: guest-exec simple stdin/stdout/stderr redirection"), some execution state variables are handled with atomic ops. However, there are no threads involved in this code (and glib sources are dispatched in the same thread), and no other obvious reason to use them. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-40-marcandre.lureau@redhat.com>
* util: replace qemu_get_local_state_pathname()Marc-André Lureau2022-04-211-4/+4
| | | | | | | | | Simplify the function to only return the directory path. Callers are adjusted to use the GLib function to build paths, g_build_filename(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-39-marcandre.lureau@redhat.com>
* qga: move qga_get_host_name()Marc-André Lureau2022-04-214-1/+60
| | | | | | | | | The function is specific to qemu-ga, no need to share it in QEMU. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220420132624.2439741-32-marcandre.lureau@redhat.com>