This will allow us to load data that has a high version_id, while using a lower version_id when saving.
Useful in case we need to revert vmstate changes but keep compatibility with QEMU versions that had a higher version_id. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- include/migration/vmstate.h | 1 + savevm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 9d09e60..cc9dbb4 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -126,6 +126,7 @@ struct VMStateDescription { const char *name; int unmigratable; int version_id; + int max_version_id; int minimum_version_id; int minimum_version_id_old; LoadStateHandler *load_state_old; diff --git a/savevm.c b/savevm.c index 87773ad..89d20d0 100644 --- a/savevm.c +++ b/savevm.c @@ -1679,7 +1679,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, VMStateField *field; int ret; - if (version_id > vmsd->version_id) { + if (version_id > MAX(vmsd->version_id, vmsd->max_version_id)) { return -EINVAL; } if (version_id < vmsd->minimum_version_id_old) { -- 1.8.3.1