aboutsummaryrefslogtreecommitdiff
path: root/qga
AgeCommit message (Collapse)Author
2024-05-01qga: guest-get-fsinfo: add optional 'total-bytes-privileged' fieldAndrey Drobyshev
Since the commit 25b5ff1a86 ("qga: add mountpoint usage info to GuestFilesystemInfo") we have 2 values reported in guest-get-fsinfo: used = (f_blocks - f_bfree), total = (f_blocks - f_bfree + f_bavail) as returned by statvfs(3). While on Windows guests that's all we can get with GetDiskFreeSpaceExA(), on POSIX guests we might also be interested in total file system size, as it's visible for root user. Let's add an optional field 'total-bytes-privileged' to GuestFilesystemInfo struct, which'd only be reported on POSIX and represent f_blocks value as returned by statvfs(3). While here, also tweak the docs to reflect better where those values come from. Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Link: https://lore.kernel.org/r/20240320161648.158226-2-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-04-30qga: Re-enable the qga-ssh-test when running without fuzzingThomas Huth
According to the comment in qga/meson.build, the test got disabled since there were problems with the fuzzing job. But instead of disabling this test completely, we should still be fine running it when fuzzing is disabled. Message-ID: <20240426162348.684143-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-03-26qga/qapi-schema: Refill doc comments to conform to current conventionsMarkus Armbruster
For legibility, wrap text paragraphs so every line is at most 70 characters long. To check the generated documentation does not change, I compared the generated HTML before and after this commit with "wdiff -3". Finds no differences. Comparing with diff is not useful, as the refilled paragraphs are visible there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240322140910.328840-13-armbru@redhat.com>
2024-03-11qga-win: Add support of Windows Server 2025 in get-osinfo commandDehan Meng
Add support of Windows Server 2025 in get-osinfo command Signed-off-by: Dehan Meng <demeng@redhat.com> Message-ID: <20240222152835.72095-4-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com> Link: https://lore.kernel.org/r/20240304134532.28506-4-kkostiuk@redhat.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-03-11qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays sizePhilippe Mathieu-Daudé
ga_get_win_name() iterates over all elements in the arrays by checking the 'version' field is non-NULL. Since the arrays are guarded by a NULL terminating element, we don't need to specify their size: static char *ga_get_win_name(...) { ... const ga_matrix_lookup_t *table = WIN_VERSION_MATRIX[tbl_idx]; const ga_win_10_0_t *win_10_0_table = ... ... while (table->version != NULL) { ^^^^^^^^^^^^^^^ while (win_10_0_table->version != NULL) { ^^^^^^^^^^^^^^^ This will simplify maintenance when adding new entries to these arrays. Split WIN_VERSION_MATRIX into WIN_CLIENT_VERSION_MATRIX and WIN_SERVER_VERSION_MATRIX because multidimensional array must have bounds for all dimensions except the first. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240222152835.72095-3-philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com> Link: https://lore.kernel.org/r/20240304134532.28506-3-kkostiuk@redhat.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-03-11qga/commands-win32: Declare const qualifier before typePhilippe Mathieu-Daudé
Most of the code base use the 'const' qualifier *before* the type being qualified. Use the same style to unify. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240222152835.72095-2-philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com> Link: https://lore.kernel.org/r/20240304134532.28506-2-kkostiuk@redhat.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-03-04qga/qapi-schema: Fix guest-set-memory-blocks documentationMarkus Armbruster
Documentation claims the command can "return NULL". "NULL" doesn't exist in JSON. "null" does, but the command returns lists, and null isn't. Correct documentation to "return an empty list". Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-13-armbru@redhat.com>
2024-03-04qga/qapi-schema: Tweak documentation of fsfreeze commandsMarkus Armbruster
"Returns:" sections of guest-fsfreeze-freeze and guest-fsfreeze-freeze-list describe both command behavior and success response. Move behavior out, so "Returns:" is only about success response. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-12-armbru@redhat.com>
2024-03-04qga/qapi-schema: Clean up "Returns" sectionsMarkus Armbruster
Drop "on success" where it is redundant with "Returns:". Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-11-armbru@redhat.com>
2024-03-04qga/qapi-schema: Delete useless "Returns" sectionsMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-10-armbru@redhat.com>
2024-03-04qga/qapi-schema: Move error documentation to new "Errors" sectionsMarkus Armbruster
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240227113921.236097-9-armbru@redhat.com>
2024-02-12qga/qapi-schema: Plug trivial documentation holesMarkus Armbruster
Add missing return member documentation of guest-get-disks, guest-get-devices, guest-get-diskstats, and guest-get-cpustats. The NVMe SMART information returned by guest-getdisks remains undocumented. Add a TODO there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240205074709.3613229-10-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-12qga/qapi-schema: Clean up documentation of guest-set-vcpusMarkus Armbruster
The command's doc comment describes the argument, but it's not marked up as such. Easy enough to fix. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240205074709.3613229-9-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-12qga/qapi-schema: Clean up documentation of guest-set-memory-blocksMarkus Armbruster
The command's doc comment describes the argument, but it's not marked up as such. Easy enough to fix. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240205074709.3613229-8-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-12qapi: Require member documentation (with loophole)Markus Armbruster
The QAPI generator forces you to document your stuff. Except for command arguments, event data, and members of enum and object types: these the generator silently "documents" as "Not documented". We can't require proper documentation there without first fixing all the offenders. We've always had too many offenders to pull that off. Right now, we have more than 500. Worse, we seem to fix old ones no faster than we add new ones: in the past year, we fixed 22 ones, but added 26 new ones. To help arrest the backsliding, make missing documentation an error unless the command, type, or event is in listed in new pragma documentation-exceptions. List all the current offenders: 117 commands and types in qapi/, and 9 in qga/. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240205074709.3613229-7-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-02-03qga/qapi-schema: Move command description right after command nameMarkus Armbruster
Documentation of commands guest-ssh-get-authorized-keys, guest-ssh-add-authorized-keys, and guest-ssh-remove-authorized-keys describes the command's purpose after its arguments. Everywhere else, we do it the other way round. Move it for consistency. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240129115008.674248-6-armbru@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-01-30qga: Solaris has net/if_arp.h and netinet/if_ether.h but not ETHER_ADDR_LENNick Briggs
Solaris has net/if_arp.h and netinet/if_ether.h rather than net/ethernet.h, but does not define ETHER_ADDR_LEN, instead providing ETHERADDRL. Signed-off-by: Nick Briggs <nicholas.h.briggs@gmail.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-01-30qga-win: Fix guest-get-fsinfo multi-disks collectionPeng Ji
When a volume has more than one disk, all disks cannot be returned correctly because there is not enough malloced memory for disk extents, so before executing DeviceIoControl for the second time, get the correct size of the required memory space to store all disk extents. Details: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_disk_extents Signed-off-by: Peng Ji <peng.ji@smartx.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-01-30guest-agent: improve help for --allow-rpcs and --block-rpcsAngel M. Villegas
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1757 Updates to qga help output and documentation for --allow-rpcs and --blocks-rpcs Signed-off-by: "Angel M. Villegas" <anvilleg@cisco.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-12-31configure, meson: rename targetos to host_osPaolo Bonzini
This variable is about the host OS, not the target. It is used a lot more since the Meson conversion, but the original sin dates back to 2003. Time to fix it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-12-31meson: remove config_targetosPaolo Bonzini
config_targetos is now empty and can be removed; its use in sourcesets that do not involve target-specific files can be replaced with an empty dictionary. In fact, at this point *all* sourcesets that do not involve target-specific files are just glorified mutable arrays. Enforce that they never test for symbols in "when:" by computing the set of files without "strict: false". Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-12-31meson: remove CONFIG_POSIX and CONFIG_WIN32 from config_targetosPaolo Bonzini
For consistency with other OSes, use if...endif for rules that are target-independent. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-12-31meson: remove OS definitions from config_targetosPaolo Bonzini
CONFIG_DARWIN, CONFIG_LINUX and CONFIG_BSD are used in some rules, but only CONFIG_LINUX has substantial use. Convert them all to if...endif. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-12-31meson: use version_compare() to compare versionPaolo Bonzini
While a simple lexicographic comparison usually works, it is less robust than a more specific algorithm designed to compare versions. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-11-25build-sys: fix meson project version usageMarc-André Lureau
Program wixl found: YES (/usr/bin/wixl) ../qga/meson.build:149:16: ERROR: Unknown variable "project". Fixes: e20d68aa0b9 ("configure, meson: use command line options to configure qemu-ga") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-11-17qga: Improve guest-exec-status error messageMarkus Armbruster
When the PID passed to guest-exec-status does not exist, we report "Invalid parameter 'pid'" Improve this to "PID 1234 does not exist" Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20231031111059.3407803-4-armbru@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2023-10-18configure, meson: use command line options to configure qemu-gaPaolo Bonzini
Preserve the functionality of the environment variables, but allow using the command line instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-10-11qapi: qga: Clarify when out-data and err-data are populatedDaniel Xu
If output is being captured for a guest-exec invocation, the out-data and err-data fields of guest-exec-status are only populated after the process is reaped. This is somewhat counter intuitive and too late to change. Thus, it would be good to document the behavior. Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-10-11qga: Fix memory leak when output stream is unusedDaniel Xu
If capture-output is requested but one of the channels goes unused (eg. we attempt to capture stderr but the command never writes to stderr), we can leak memory. guest_exec_output_watch() is (from what I understand) unconditionally called for both streams if output capture is requested. The first call will always pass the `p->size == p->length` check b/c both values are 0. Then GUEST_EXEC_IO_SIZE bytes will be allocated for the stream. But when we reap the exited process there's a `gei->err.length > 0` check to actually free the buffer. Which does not get run if the command doesn't write to the stream. Fix by making free() unconditional. Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-10-11qga: Remove platform GUID definitionsAkihiko Odaki
GUID_DEVINTERFACE_DISK and GUID_DEVINTERFACE_STORAGEPORT are already defined by MinGW-w64. They are not only unnecessary, but can lead to duplicate definition errors at link time with some unknown condition. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-09-08qga/: spelling fixesMichael Tokarev
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Eric Blake <eblake@redhat.com>
2023-09-07configure, meson: remove target OS symbols from config-host.makPaolo Bonzini
Stop applying config-host.mak to the sourcesets, since it does not have any more CONFIG_* symbols coming from the command line. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-07-10QGA VSS: Add log in functions begin/endKonstantin Kostiuk
Add several qga_debug() statements in functions. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-10QGA VSS: Print error in err_setKonstantin Kostiuk
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-10QGA VSS: Replace 'fprintf(stderr' with qga_debugKonstantin Kostiuk
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-10QGA VSS: Add wrapper to send log to debugger and stderrKonstantin Kostiuk
Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-10qga: Add new option --allow-rpcsKonstantin Kostiuk
The allow-rpcs option accepts a comma-separated list of RPCs to enable. This option is opposite to --block-rpcs. Using --block-rpcs and --allow-rpcs at the same time is not allowed. resolves: https://gitlab.com/qemu-project/qemu/-/issues/1505 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-10qga: Rename ga_disable_not_allowed -> ga_disable_not_allowed_freezeKonstantin Kostiuk
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-07-07meson.build: Remove the logic to link C code with the C++ linkerThomas Huth
We are not mixing C++ with C code anymore, the only remaining C++ code in qga/vss-win32/ is used for a plain C++ executable. Thus we can remove the hacks for linking C code with the C++ linker now to simplify meson.build a little bit, and also to avoid that some C++ code sneaks in by accident again. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20230706064736.178962-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-06-09spelling: informationMichael Tokarev
3 trivial fixes: 2 .json comments which goes to executables, and 1 .h file comment. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2023-05-25meson: fix rule for qemu-ga installerPaolo Bonzini
The bindir variable is not available in the "glib" variable, which is an internal dependency (created with "declare_dependency"). Use glib_pc instead, which contains the variable as it is instantiated from glib-2.0.pc. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-05-18meson: use prefer_static optionPaolo Bonzini
The option is new in Meson 0.63 and removes the need to pass "static: true" to all dependency and find_library invocation. Actually cleaning up the invocations is left for a separate patch. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-05-10qga/qapi-schema: Reformat doc comments to conform to current conventionsMarkus Armbruster
Change # @name: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed # do eiusmod tempor incididunt ut labore et dolore magna aliqua. to # @name: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed # do eiusmod tempor incididunt ut labore et dolore magna aliqua. See recent commit "qapi: Relax doc string @name: description indentation rules" for rationale. Reflow paragraphs to 70 columns width, and consistently use two spaces to separate sentences. To check the generated documentation does not change, I compared the generated HTML before and after this commit with "wdiff -3". Finds no differences. Comparing with diff is not useful, as the reflown paragraphs are visible there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230428105429.1687850-17-armbru@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com>
2023-05-04qga: Fix suspend on Linux guests without systemdMark Somerville
Allow the Linux guest agent to attempt each of the suspend methods (systemctl, pm-* and writing to /sys) in turn. Prior to this guests without systemd failed to suspend due to `guest_suspend` returning early regardless of the return value of `systemd_supports_mode`. Signed-off-by: Mark Somerville <mark@qpok.net> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-05-04qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601Thomas Huth
All current versions of glib require _WIN32_WINNT set to 0x0601 or higher already, and we also use this value as a minimum in our osdep.h header file, so there is no way to still compile this code with an older version of the Windows ABI. Thus we can drop this check now. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-05-04qga: Add `merged` variant to GuestExecCaptureOutputModeDaniel Xu
Currently, any captured output (via `capture-output`) is segregated into separate GuestExecStatus fields (`out-data` and `err-data`). This means that downstream consumers have no way to reassemble the captured data back into the original stream. This is relevant for chatty and semi-interactive (ie. read only) CLI tools. Such tools may deliberately interleave stdout and stderr for visual effect. If segregated, the output becomes harder to visually understand. This commit adds a new enum variant to the GuestExecCaptureOutputMode qapi to merge the output streams such that consumers can have a pristine view of the original command output. Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-05-04qga: Refactor guest-exec capture-output to take enumDaniel Xu
Previously capture-output was an optional boolean flag that either captured all output or captured none. While this is OK in most cases, it lacks flexibility for more advanced capture cases, such as wanting to only capture stdout. This commits refactors guest-exec qapi to take an enum for capture mode instead while preserving backwards compatibility. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-05-04qga/linux: add usb support to guest-get-fsinfoKfir Manor
Signed-off-by: Kfir Manor <kfir@daynix.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2023-04-28qga/qapi-schema: Fix member documentation markupMarkus Armbruster
GuestDiskStatsInfo's member documentation is parsed as ordinary text due to missing colons. The generated documentation shows these members as "Not documented". The fix is obvious: add the missing colons. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230425064223.820979-12-armbru@redhat.com>
2023-04-28qga/qapi-schema: Fix a misspelled referenceMarkus Armbruster
Code returns a list of GuestNetworkInterface, documentation claims GuestNetworkInfo, which doesn't exist. Fix the documentation. Fixes: 3424fc9f16a1 (qemu-ga: add guest-network-get-interfaces command) Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230425064223.820979-3-armbru@redhat.com>