mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
migration: dump vmstate info as a json file for static analysis
This commit adds a new command, '-dump-vmstate', that takes a filename as an argument. When executed, QEMU will dump the vmstate information for the machine type it's invoked with to the file, and quit. The JSON-format output can then be used to compare the vmstate info for different QEMU versions, specifically to test whether live migration would break due to changes in the vmstate data. A Python script that compares the output of such JSON dumps is included in the following commit. Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
e325b49a32
commit
abfd9ce341
4 changed files with 168 additions and 0 deletions
13
vl.c
13
vl.c
|
@ -2935,6 +2935,7 @@ int main(int argc, char **argv, char **envp)
|
|||
1024 * 1024;
|
||||
ram_addr_t maxram_size = default_ram_size;
|
||||
uint64_t ram_slots = 0;
|
||||
FILE *vmstate_dump_file = NULL;
|
||||
|
||||
atexit(qemu_run_exit_notifiers);
|
||||
error_set_progname(argv[0]);
|
||||
|
@ -3944,6 +3945,13 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
configure_msg(opts);
|
||||
break;
|
||||
case QEMU_OPTION_dump_vmstate:
|
||||
vmstate_dump_file = fopen(optarg, "w");
|
||||
if (vmstate_dump_file == NULL) {
|
||||
fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
os_parse_cmd_args(popt->index, optarg);
|
||||
}
|
||||
|
@ -4495,6 +4503,11 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
|
||||
qdev_prop_check_global();
|
||||
if (vmstate_dump_file) {
|
||||
/* dump and exit */
|
||||
dump_vmstate_json_to_file(vmstate_dump_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (incoming) {
|
||||
Error *local_err = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue