qga: clean up command source locations and conditionals
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest22 patches 5 repliesIn review
- v222 patches 47 repliesSuperseded
- v120 patches 19 repliesSuperseded
Changes in v3 from the cover letter
- Fix missing --help output for new -c / --config arg
- Fix typos
- Avoid repeated qmp_command_is_enabled call
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/22 | qga: drop blocking of guest-get-memory-block-size commandqga/ qga/ | +2 | 0 replies | |
| 2/22 | qga: move linux vcpu command impls to commands-linux.cqga/ qga/ | +141 | 0 replies | |
| 3/22 | qga: move linux suspend command impls to commands-linux.cqga/ qga/ | +265 | 0 replies | |
| 4/22 | qga: move linux fs/disk command impls to commands-linux.cqga/ qga/ | +904 | 0 replies | |
| 5/22 | qga: move linux disk/cpu stats command impls to commands-linux.cqga/ qga/ | +195 | 0 replies | |
| 6/22 | qga: move linux memory block command impls to commands-linux.cqga/ qga/ | +309 | 0 replies | |
| 7/22 | qga: move CONFIG_FSFREEZE/TRIM to be meson defined optionsmeson.build qga/ | +15 | 1 reply | |
| 8/22 | qga: conditionalize schema for commands unsupported on Windowsqga/ qga/ qga/ | +32 | 0 replies | |
| 9/22 | qga: conditionalize schema for commands unsupported on non-Linux POSIXqga/ qga/ | +17 | 0 replies | |
| 10/22 | qga: conditionalize schema for commands requiring getifaddrsqga/ qga/ | +10 | 0 replies | |
| 11/22 | qga: conditionalize schema for commands requiring linux/win32qga/ qga/ qga/ | +30 | 1 reply | |
| 12/22 | qga: conditionalize schema for commands only supported on Windowsqga/ qga/ | +10 | 0 replies | |
| 13/22 | qga: conditionalize schema for commands requiring fsfreezeqga/ qga/ | +10 | 0 replies | |
| 14/22 | qga: conditionalize schema for commands requiring fstrimqga/ qga/ | +6 | 0 replies | |
| 15/22 | qga: conditionalize schema for commands requiring libudevqga/ qga/ | +4 | 0 replies | |
| 16/22 | qga: conditionalize schema for commands requiring utmpxqga/ qga/ | +5 | 0 replies | |
| 17/22 | qga: conditionalize schema for commands not supported on other UNIXmeson.build qga/ qga/ | +3 | 0 replies | |
| 18/22 | qga: don't disable fsfreeze commands if vss_init failsqga/ qga/ | +7 | 1 reply | |
| 19/22 | qga: move declare of QGAConfig struct to top of fileqga/ | +22 | 0 replies | |
| 20/22 | qga: remove pointless 'blockrpcs_key' variableqga/ | +3 | 0 replies | |
| 21/22 | qga: allow configuration file path via the clidocs/ qga/ | +38 | 1 reply | |
| 22/22 | qga: centralize logic for disabling/enabling commandsdocs/ qga/ qga/ +1 more | +70 | 1 reply |
Reviews trailers per patch
All 22 patches have a Reviewed-by or Acked-by.
| Patch | Manos Pitsidianakis | Philippe Mathieu-Daudé | Konstantin Kostiuk |
|---|---|---|---|
| 1/22 | R-b | R-b | |
| 2/22 | R-b | R-b | R-b |
| 3/22 | R-b | R-b | R-b |
| 4/22 | R-b | R-b | R-b |
| 5/22 | R-b | R-b | |
| 6/22 | R-b | R-b | |
| 7/22 | R-b | ||
| 8/22 | R-b | R-b | |
| 9/22 | R-b | R-b | |
| 10/22 | R-b | R-b | |
| 11/22 | R-b | ||
| 12/22 | R-b | R-b | |
| 13/22 | R-b | R-b | |
| 14/22 | R-b | R-b | |
| 15/22 | R-b | R-b | |
| 16/22 | R-b | R-b | |
| 17/22 | R-b | R-b | |
| 18/22 | R-b | R-b | |
| 19/22 | R-b | R-b | |
| 20/22 | R-b | R-b | |
| 21/22 | R-b | ||
| 22/22 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v3 00/22] qga: clean up command source locations and conditionals
This series is a side effect of other work I started, to attempt to make the QGA safe to use in confidential VMs by automatically restricting the permitted commands. Since this cleanup stands on its own, I'm sending it now.
The QGA codebase has a very complicated maze of #ifdefs to create stubs for the various commands that cannot be implemented on certain platforms. It then has further logic to dynamically disable the stub commands at runtime, except this is not consistently applied, so some commands remain enabled despite being merely stubs.
The resulting code is hard to follow, when trying to understand exactly what commands are available under what circumstances, and when changing impls it is easy to get the #ifdefs wrong, resulting in stubs getting missed on platforms without a real impl. In some cases, we have multiple stubs for the same command, due to the maze of #ifdefs.
The QAPI schema language has support for many years for expressing conditions against commands when declaring them. This results in the QAPI code generator omitting their implementation entirely at build time. This has mutliple benefits
* The unsupported commands are guaranteed to not exist at runtime
* No stubs need ever be defined in the code
* The generated QAPI reference manual documents the build conditions
This series is broadly split into three parts
* Moving tonnes of Linux only commands out of commands-posix.c into commands-linux.c to remove many #ifdefs.
* Adding 'if' conditions in the QAPI schema to reflect the build conditions, removing many more #ifdefs
* Sanitizing the logic for disabling/enabling commands at runtime to guarantee consistency
Changed in v3:
- Fix missing --help output for new -c / --config arg
- Fix typos
- Avoid repeated qmp_command_is_enabled call
Changed in v2:
- Make FSFreeze error reporting distinguish inability to enable VSS from user config choice
- Fully remove ga_command_init_blockedrpcs() methods. No more special case disabling of commands. Either they're disabled at build time, or disabled by user config, or by well defined rule ie not permitted during FS freeze.
- Apply rules later in startup to avoid crash from NULL config pointer
- Document changed error messages in commit messages
- Add -c / --config command line parameter
- Fix mistaken enabling of fsfreeze hooks on win32
Daniel P. Berrangé (22):
qga: drop blocking of guest-get-memory-block-size command
qga: move linux vcpu command impls to commands-linux.c
qga: move linux suspend command impls to commands-linux.c
qga: move linux fs/disk command impls to commands-linux.c
qga: move linux disk/cpu stats command impls to commands-linux.c
qga: move linux memory block command impls to commands-linux.c
qga: move CONFIG_FSFREEZE/TRIM to be meson defined options
qga: conditionalize schema for commands unsupported on Windows
qga: conditionalize schema for commands unsupported on non-Linux POSIX
qga: conditionalize schema for commands requiring getifaddrs
qga: conditionalize schema for commands requiring linux/win32
qga: conditionalize schema for commands only supported on Windows
qga: conditionalize schema for commands requiring fsfreeze
qga: conditionalize schema for commands requiring fstrim
qga: conditionalize schema for commands requiring libudev
qga: conditionalize schema for commands requiring utmpx
qga: conditionalize schema for commands not supported on other UNIX
qga: don't disable fsfreeze commands if vss_init fails
qga: move declare of QGAConfig struct to top of file
qga: remove pointless 'blockrpcs_key' variable
qga: allow configuration file path via the cli
qga: centralize logic for disabling/enabling commands
docs/interop/qemu-ga.rst | 19 + meson.build | 16 + qga/commands-bsd.c | 24 - qga/commands-common.h | 9 - qga/commands-linux.c | 1805 +++++++++++++++++++++++++++++ qga/commands-posix.c | 2373 +++----------------------------------- qga/commands-win32.c | 78 +- qga/main.c | 224 ++-- qga/qapi-schema.json | 153 ++- 9 files changed, 2240 insertions(+), 2461 deletions(-)
Signature · 1 line
2.45.1