aboutsummaryrefslogtreecommitdiff
path: root/qga
AgeCommit message (Collapse)Author
2024-07-23qga/linux: Add new api 'guest-network-get-route'Dehan Meng
The Route information of the Linux VM needs to be used by administrators and users when debugging network problems and troubleshooting. Signed-off-by: Dehan Meng <demeng@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-ID: <20240613092802.346246-2-demeng@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga/commands-posix: Make ga_wait_child() return booleanZhao Liu
Make ga_wait_child() return boolean and check the returned boolean in ga_run_command() instead of dereferencing @errp. Cc: Michael Roth <michael.roth@amd.com> Cc: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-ID: <20240716162351.270095-1-zhao1.liu@intel.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: centralize logic for disabling/enabling commandsDaniel P. Berrangé
It is confusing having many different pieces of code enabling and disabling commands, and it is not clear that they all have the same semantics, especially wrt prioritization of the block/allow lists. The code attempted to prevent the user from setting both the block and allow lists concurrently, however, the logic was flawed as it checked settings in the configuration file separately from the command line arguments. Thus it was possible to set a block list in the config file and an allow list via a command line argument. The --dump-conf option also creates a configuration file with both keys present, even if unset, which means it is creating a config that cannot actually be loaded again. Centralizing the code in a single method "ga_apply_command_filters" will provide a strong guarantee of consistency and clarify the intended behaviour. With this there is no compelling technical reason to prevent concurrent setting of both the allow and block lists, so this flawed restriction is removed. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-ID: <20240712132459.3974109-23-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: allow configuration file path via the cliDaniel P. Berrangé
Allowing the user to set the QGA_CONF environment variable to change the default configuration file path is very unusual practice, made more obscure since this ability is not documented. This introduces the more normal '-c PATH' / '--config=PATH' command line argument approach. This requires that we parse the comamnd line twice, since we want the command line arguments to take priority over the configuration file settings in general. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-ID: <20240712132459.3974109-22-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: remove pointless 'blockrpcs_key' variableDaniel P. Berrangé
This variable was used to support back compat for the old config file key name, and became redundant after the following change: commit a7a2d636ae4549ef0551134d4bf8e084a14431c4 Author: Philippe Mathieu-Daudé <philmd@linaro.org> Date: Thu May 30 08:36:43 2024 +0200 qga: Remove deprecated 'blacklist' argument / config key Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-21-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move declare of QGAConfig struct to top of fileDaniel P. Berrangé
It is referenced by QGAState already, and it is clearer to declare all data types at the top of the file, rather than have them mixed with code later. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-20-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: don't disable fsfreeze commands if vss_init failsDaniel P. Berrangé
The fsfreeze commands are already written to report an error if vss_init() fails. Reporting a more specific error message is more helpful than a generic "command is disabled" message, which cannot between an admin config decision and lack of platform support. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240712132459.3974109-19-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands not supported on other UNIXDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the commands on other UNIX. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-18-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring utmpxDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the get-users command on POSIX platforms lacking required APIs. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-17-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring libudevDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the schema to fully exclude generation of the filesystem trimming commands on POSIX platforms lacking required APIs. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-16-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring fstrimDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the filesystem trimming commands on POSIX platforms lacking required APIs. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-15-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring fsfreezeDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the schema to fully exclude generation of the filesystem freezing commands on POSIX platforms lacking the required APIs. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-14-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands only supported on WindowsDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the commands on non-Windows. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-13-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring linux/win32Daniel P. Berrangé
Some commands were blocked based on CONFIG_FSFREEZE, but their impl had nothing todo with CONFIG_FSFREEZE, and were instead either Linux-only, or Win+Linux-only. Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the stats and fsinfo commands on platforms that can't support them. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-12-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands requiring getifaddrsDaniel P. Berrangé
Rather than creating stubs for every comamnd that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the network interface command on POSIX platforms lacking getifaddrs(). The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-11-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands unsupported on non-Linux POSIXDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the commands on non-Linux POSIX platforms The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This has the additional benefit that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-10-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: conditionalize schema for commands unsupported on WindowsDaniel P. Berrangé
Rather than creating stubs for every command that just return QERR_UNSUPPORTED, use 'if' conditions in the QAPI schema to fully exclude generation of the commands on Windows. The command will be rejected at QMP dispatch time instead, avoiding reimplementing rejection by blocking the stub commands. This changes the error message for affected commands from {"class": "CommandNotFound", "desc": "Command FOO has been disabled"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} This also fixes an accidental inconsistency where some commands (guest-get-diskstats & guest-get-cpustats) are implemented as stubs, yet not added to the blockedrpc list. Those change their error message from {"class": "GenericError, "desc": "this feature or command is not currently supported"} to {"class": "CommandNotFound", "desc": "The command FOO has not been found"} The final additional benefit is that the QGA protocol reference now documents what conditions enable use of the command. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-9-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move CONFIG_FSFREEZE/TRIM to be meson defined optionsDaniel P. Berrangé
Defining these at the meson level allows them to be used a conditional tests in the QAPI schemas. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240712132459.3974109-8-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move linux memory block command impls to commands-linux.cDaniel P. Berrangé
The qmp_guest_{set,get}_{memory_blocks,block_info} command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c This also removes a "#ifdef CONFIG_LINUX" that was nested inside a "#ifdef __linux__". Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-7-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move linux disk/cpu stats command impls to commands-linux.cDaniel P. Berrangé
The qmp_guest_{diskstats,cpustats} command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c This also removes a "#ifdef CONFIG_LINUX" that was nested inside a "#ifdef __linux__". Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-ID: <20240712132459.3974109-6-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move linux fs/disk command impls to commands-linux.cDaniel P. Berrangé
The qmp_guest_{fstrim, get_fsinfo, get_disks} command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-5-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move linux suspend command impls to commands-linux.cDaniel P. Berrangé
The qmp_guest_suspend_{disk,ram,hybrid} command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-4-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: move linux vcpu command impls to commands-linux.cDaniel P. Berrangé
The qmp_guest_set_vcpus and qmp_guest_get_vcpus command impls in commands-posix.c are surrounded by '#ifdef __linux__' so should instead live in commands-linux.c Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240712132459.3974109-3-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-19qga: drop blocking of guest-get-memory-block-size commandDaniel P. Berrangé
This command has never existed in tree, since it was renamed to guest-get-memory-block-info before being merged. Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240712132459.3974109-2-berrange@redhat.com> Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-07-06qapi: update prose in note blocksJohn Snow
Where I've noticed, rephrase the note to read more fluently. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240626222128.406106-12-jsnow@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2024-07-06qapi: convert "Note" sections to plain rSTJohn Snow
We do not need a dedicated section for notes. By eliminating a specially parsed section, these notes can be treated as normal rST paragraphs in the new QMP reference manual, and can be placed and styled much more flexibly. Convert all existing "Note" and "Notes" sections to pure rST. As part of the conversion, capitalize the first letter of each sentence and add trailing punctuation where appropriate to ensure notes look sensible and consistent in rendered HTML documentation. Markup is also re-aligned to the de-facto standard of 3 spaces for directives. Update docs/devel/qapi-code-gen.rst to reflect the new paradigm, and update the QAPI parser to prohibit "Note" sections while suggesting a new syntax. The exact formatting to use is a matter of taste, but a good candidate is simply: .. note:: lorem ipsum ... ... dolor sit amet ... ... consectetur adipiscing elit ... ... but there are other choices, too. The Sphinx readthedocs theme offers theming for the following forms (capitalization unimportant); all are adorned with a (!) symbol () in the title bar for rendered HTML docs. See https://sphinx-rtd-theme.readthedocs.io/en/stable/demo/demo.html#admonitions for examples of each directive/admonition in use. These are rendered in orange: .. Attention:: ... .. Caution:: ... .. WARNING:: ... These are rendered in red: .. DANGER:: ... .. Error:: ... These are rendered in green: .. Hint:: ... .. Important:: ... .. Tip:: ... These are rendered in blue: .. Note:: ... .. admonition:: custom title admonition body text This patch uses ".. note::" almost everywhere, with just two "caution" directives. Several instances of "Notes:" have been converted to merely ".. note::", or multiple ".. note::" where appropriate. ".. admonition:: notes" is used in a few places where we had an ordered list of multiple notes that would not make sense as standalone/separate admonitions. Two "Note:" following "Example:" have been turned into ordinary paragraphs within the example. NOTE: Because qapidoc.py does not attempt to preserve source ordering of sections, the conversion of Notes from a "tagged section" to an "untagged section" means that rendering order for some notes *may change* as a result of this patch. The forthcoming qapidoc.py rewrite strictly preserves source ordering in the rendered documentation, so this issue will be rectified in the new generator. Signed-off-by: John Snow <jsnow@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> [for block*.json] Message-ID: <20240626222128.406106-11-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Commit message clarified slightly, period added to one more note] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2024-06-04qga: Remove deprecated 'blacklist' argument / config keyPhilippe Mathieu-Daudé
The 'blacklist' argument / config key are deprecated since commit 582a098e6c ("qga: Replace 'blacklist' command line and config file options by 'block-rpcs'"), time to remove them. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20240530070413.19181-1-philmd@linaro.org>
2024-05-27qga: Shorten several error messagesMarkus Armbruster
Some, but not all error messages are of the form Guest agent command failed, error was '<actual error message>' For instance, command guest-exec can fail with an error message like Guest agent command failed, error was 'Failed to execute child process “/bin/invalid-cmd42” (No such file or directory)' Shorten this to just just the actual error message. The guest-exec example becomes Failed to execute child process “/bin/invalid-cmd42” (No such file or directory) Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240514105829.729342-3-armbru@redhat.com> [Superfluous #include "qapi/qmp/qerror.h" deleted] Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-27qga-win32: Improve guest-set-user-password, guest-file-open errorsMarkus Armbruster
When guest-set-user-password's argument @password can't be converted from UTF-8 to UTF-16, we report something like Guest agent command failed, error was 'Invalid sequence in conversion input' Improve this to can't convert 'password' to UTF-16: Invalid sequence in conversion input Likewise for argument @username, and guest-file-open argument @path, even though I'm not sure you can actually get invalid input past the QMP core there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240514105829.729342-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-14Remove glib compatibility code that is not required anymoreThomas Huth
Now that we bumped the minimum glib version to 2.66, we can drop the old code. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240418101056.302103-9-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-05-14Bump minimum glib version to v2.66Thomas Huth
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é <berrange@redhat.com> Message-ID: <20240418101056.302103-8-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-05-03qga/commands-posix: fix typo in qmp_guest_set_user_passwordPaolo Bonzini
qga/commands-posix.c does not compile on FreeBSD due to a confusion between "chpasswdata" (wrong) and "chpasswddata" (used in the #else branch). Fixes: 0e5b75a390 ("qga/commands-posix: qmp_guest_set_user_password: use ga_run_command helper") Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-05-01qga: Implement SSH commands for Windowsaidaleuc
Signed-off-by: Aidan Leuck <aidan_leuck@selinc.com> Tested-by: Dehan Meng <demeng@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Link: https://lore.kernel.org/r/20240424144029.30665-3-aidan_leuck@selinc.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga: Refactor common SSH functionsaidaleuc
Message-Id: <20240424144029.30665-2-aidan_leuck@selinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit In preparation of a Windows implementation, move the non-POSIX specific code to commands-common-ssh. Signed-off-by: Aidan Leuck <aidan_leuck@selinc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Dehan Meng <demeng@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Link: https://lore.kernel.org/r/20240424144029.30665-2-aidan_leuck@selinc.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga/commands-posix: qmp_guest_set_user_password: use ga_run_command helperAndrey Drobyshev
There's no need to check for the existence of the "chpasswd", "pw" executables, as the exec() call will do that for us. 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-8-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga/commands-posix: don't do fork()/exec() when suspending via sysfsAndrey Drobyshev
Since commit 246d76eba ("qga: guest_suspend: decoupling pm-utils and sys logic") pm-utils logic is running in a separate child from the sysfs logic. Now when suspending via sysfs we don't really need to do that in a separate process as we only need to perform one write to /sys/power/state. Let's just use g_file_set_contents() to simplify things here. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> 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-7-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga/commands-posix: execute_fsfreeze_hook: use ga_run_command helperAndrey Drobyshev
There's no need to check for the existence of the hook executable, as the exec() call will do that for us. 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-6-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga/commands-posix: qmp_guest_set_time: use ga_run_command helperAndrey Drobyshev
There's no need to check for the existence of "/sbin/hwclock", the exec() call will do that for us. 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-5-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga/commands-posix: qmp_guest_shutdown: use ga_run_command helperAndrey Drobyshev
Also remove the G_GNUC_UNUSED attribute added in the previous commit from the helper. 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-4-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
2024-05-01qga: introduce ga_run_command() helper for guest cmd executionAndrey Drobyshev
When executing guest commands in *nix environment, we repeat the same fork/exec pattern multiple times. Let's just separate it into a single helper which would also be able to feed input data into the launched process' stdin. This way we can avoid code duplication. To keep the history more bisectable, let's replace qmp commands implementations one by one. Also add G_GNUC_UNUSED attribute to the helper and remove it in the next commit. Originally-by: Yuri Pudgorodskiy <yur@virtuozzo.com> 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-3-andrey.drobyshev@virtuozzo.com Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
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>