Split the function, making itself to be the helper to dump all non-iterable
device states (early_vmsd excluded). Move the precopy end logic out to the
two callers that need it.
With it, we can remove the in_postcopy parameter. Meanwhile, renaming the
function to be qemu_savevm_state_non_iterable(): we don't need the keyword
"complete" because non-iterable doesn't iterate anyway, and we don't need
precopy because we moved precopy specialties out.
NOTE: this patch introduced one new migrate_get_current() user; will be
removed in follow up patch.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Tested-by: Lukas Straub <lukasstraub2@web.de>
Link: https://lore.kernel.org/qemu-devel/20260127185254.3954634-17-peterx@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
*/
qemu_savevm_send_postcopy_listen(fb);
- ret = qemu_savevm_state_complete_precopy_non_iterable(fb, true);
+ ret = qemu_savevm_state_non_iterable(fb);
if (ret) {
error_setg(errp, "Postcopy save non-iterable device states failed");
goto fail_closefb;
goto fail;
}
- if (qemu_savevm_state_complete_precopy_non_iterable(fb, false)) {
+ if (qemu_savevm_state_non_iterable(fb)) {
goto fail;
}
+
+ qemu_savevm_state_end_precopy(s, fb);
+
/*
* Since we are going to get non-iterable state data directly
* from s->bioc->data, explicit flush is needed here.
qemu_savevm_state_vm_desc(s, f);
}
-int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
- bool in_postcopy)
+int qemu_savevm_state_non_iterable(QEMUFile *f)
{
MigrationState *ms = migrate_get_current();
int64_t start_ts_each, end_ts_each;
end_ts_each - start_ts_each);
}
- if (!in_postcopy) {
- /* Postcopy stream will still be going */
- qemu_savevm_state_end_precopy(ms, f);
- }
-
trace_vmstate_downtime_checkpoint("src-non-iterable-saved");
return 0;
return ret;
}
- ret = qemu_savevm_state_complete_precopy_non_iterable(f, false);
+ ret = qemu_savevm_state_non_iterable(f);
if (ret) {
return ret;
}
+ qemu_savevm_state_end_precopy(migrate_get_current(), f);
+
return qemu_fflush(f);
}
Error **errp);
int qemu_load_device_state(QEMUFile *f, Error **errp);
int qemu_loadvm_approve_switchover(void);
-int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
- bool in_postcopy);
+int qemu_savevm_state_non_iterable(QEMUFile *f);
bool qemu_loadvm_load_state_buffer(const char *idstr, uint32_t instance_id,
char *buf, size_t len, Error **errp);