qapi/dump: add allowed-by-guest feature to win-dmp
PATCH 1/1 qapi/dump: add allowed-by-guest feature to win-dmp
Commit 1c0e259c5a35 ("dump: make win_dump_available() check vmcoreinfo for a Windows dump header") changed two things in a way that is visible to QMP clients but not to introspection:
query-dump-guest-memory-capability now lists win-dmp only for a guest that has published a Windows dump header through the vmcoreinfo device, and dump-guest-memory, which shares win_dump_available(), rejects the format otherwise. Before that, both accepted win-dmp on any x86 machine.
A client that wants to select win-dmp automatically therefore cannot trust the capability query on its own: on an older QEMU it reports win-dmp for every x86 guest, Linux ones included, where the resulting dump is useless. libvirt ran into exactly this while picking a format for on_crash and watchdog triggered dumps, and has no way to tell the two behaviours apart.
Add an 'allowed-by-guest' feature to the win-dmp member of DumpGuestMemoryFormat so the fixed behaviour becomes discoverable. DumpGuestMemoryFormat is reachable from both query-dump-guest-memory-capability's return type and dump-guest-memory's arguments, so a single flag covers both halves of the change. Where the feature is absent, a reported win-dmp says nothing about the guest, and a client that needs the dump to be loadable afterwards should fall back to elf.
---
libvirt discussion:
https://lists.libvirt.org/archives/list/[email protected]/thread/7QBRM2GOC7M5E7EAIE44JNWBSKNN62BC/
qapi/dump.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
qapi/dump.json +8 -1
@@ -38,6 +38,13 @@ # @win-dmp: Windows full crashdump format, can be used instead of ELF # converting (since 2.13) # +# Features: +# +# @allowed-by-guest: If present, @win-dmp is listed by +# `query-dump-guest-memory-capability`, and accepted by +# `dump-guest-memory`, only when the guest has published a Windows +# dump header through the vmcoreinfo device (since 11.1) +# # Since: 2.0 ## { 'enum': 'DumpGuestMemoryFormat',
@@ -45,7 +52,7 @@ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'kdump-raw-zlib', 'kdump-raw-lzo', 'kdump-raw-snappy', - 'win-dmp' ] } + { 'name': 'win-dmp', 'features': ['allowed-by-guest'] } ] } ## # @dump-guest-memory:
Signature · 1 line
2.53.0
Quoted 8 lines · Denis V. Lunev
Commit
1c0e259c5a35("dump: makewin_dump_available()check vmcoreinfo for a Windows dump header") changed two things in a way that is visible to QMP clients but not to introspection:
query-dump-guest-memory-capability now lists win-dmp only for a guest that has published a Windows dump header through the vmcoreinfo device, and dump-guest-memory, which shareswin_dump_available(), rejects the format otherwise. Before that, both accepted win-dmp on any x86 machine.
IIUC, the old behaviour of 'dump-guest-memory' would always return an error if invoked with win-dmp on Linux guests, as the first lines of create_win_dump used to be:
if (s->guest_note_size != VMCOREINFO_WIN_DUMP_NOTE_SIZE32 &&
s->guest_note_size != VMCOREINFO_WIN_DUMP_NOTE_SIZE64) {
error_setg(errp, "win-dump: invalid vmcoreinfo note size");
return;
}At most we've change the error message that is seen by the client AFAICT.
IOW from a client facing view, what changed in 11.1.0 is simply that 'query-dump-guest-memory-capability' now accurately reflects what can be used by 'dump-guest-memory'.
Quoted 47 lines
A client that wants to select win-dmp automatically therefore cannot trust the capability query on its own: on an older QEMU it reports win-dmp for every x86 guest, Linux ones included, where the resulting dump is useless. libvirt ran into exactly this while picking a format for
on_crashand watchdog triggered dumps, and has no way to tell the two behaviours apart.Add an 'allowed-by-guest' feature to the win-dmp member of DumpGuestMemoryFormat so the fixed behaviour becomes discoverable. DumpGuestMemoryFormat is reachable from both query-dump-guest-memory-capability's return type and dump-guest-memory's arguments, so a single flag covers both halves of the change. Where the feature is absent, a reported win-dmp says nothing about the guest, and a client that needs the dump to be loadable afterwards should fall back to elf.
CC Eric Blake <[email protected]>CC Markus Armbruster <[email protected]>CC "Marc-André Lureau" <[email protected]>Suggested-by Daniel P. Berrangé <[email protected]>Signed-off-by Denis V. Lunev <[email protected]>---
libvirt discussion:
https://lists.libvirt.org/archives/list/[email protected]/thread/7QBRM2GOC7M5E7EAIE44JNWBSKNN62BC/qapi/dump.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)qapi/dump.json +7
-0@@ -38,6 +38,13 @@ # @win-dmp: Windows full crashdump format, can be used instead of ELF # converting (since 2.13) # +# Features: +# +# @allowed-by-guest: If present, @win-dmp is listed by +# `query-dump-guest-memory-capability`, and accepted by +# `dump-guest-memory`, only when the guest has published a Windows +# dump header through the vmcoreinfo device (since 11.1) +# # Since: 2.0 ## { 'enum': 'DumpGuestMemoryFormat',
qapi/dump.json line 58
Quoted 8 lines
qapi/dump.json +1
-1@@ -45,7 +52,7 @@ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'kdump-raw-zlib', 'kdump-raw-lzo', 'kdump-raw-snappy', - 'win-dmp' ] } + { 'name': 'win-dmp', 'features': ['allowed-by-guest'] } ] } ## # @dump-guest-memory:
Regardless of quibble over the commit message
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|