dump: Add command interface for kdump-raw formats

The QMP dump API represents the dump format as an enumeration. Add three
new enumerators, one for each supported kdump compression, each named
"kdump-raw-*".

For the HMP command line, rather than adding a new flag corresponding to
each format, it seems more human-friendly to add a single flag "-R" to
switch the kdump formats to "raw" mode. The choice of "-R" also
correlates nicely to the "makedumpfile -R" option, which would serve to
reassemble a flattened vmcore.

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[ Marc-André: replace loff_t with off_t, indent fixes ]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230918233233.1431858-4-stephen.s.brennan@oracle.com>
This commit is contained in:
Stephen Brennan 2023-09-18 16:32:33 -07:00 committed by Marc-André Lureau
parent d43a01db28
commit e6549197f7
4 changed files with 76 additions and 11 deletions

View file

@ -19,6 +19,7 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
bool paging = qdict_get_try_bool(qdict, "paging", false);
bool zlib = qdict_get_try_bool(qdict, "zlib", false);
bool lzo = qdict_get_try_bool(qdict, "lzo", false);
bool raw = qdict_get_try_bool(qdict, "raw", false);
bool snappy = qdict_get_try_bool(qdict, "snappy", false);
const char *file = qdict_get_str(qdict, "filename");
bool has_begin = qdict_haskey(qdict, "begin");
@ -40,16 +41,28 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
}
if (zlib) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
if (zlib && raw) {
if (raw) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_RAW_ZLIB;
} else {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
}
}
if (lzo) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
if (raw) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_RAW_LZO;
} else {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
}
}
if (snappy) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
if (raw) {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_RAW_SNAPPY;
} else {
dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
}
}
if (has_begin) {