On 2/4/21 6:18 PM, Daniel P. Berrangé wrote:
> This is an incremental step in converting vmstate loading code to report
> via Error objects instead of printing directly to the console/monitor.
>
> Signed-off-by: Daniel P. Berrangé <[email protected]>
> ---
> migration/savevm.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
...
> if (migrate_get_current()->send_configuration) {
> - if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
> - error_report("Configuration section missing");
> + v = qemu_get_byte(f);
> + if (v != QEMU_VM_CONFIGURATION) {
> + error_setg(errp, "Configuration section missing, %x != %x",
> + v, QEMU_VM_CONFIGURATION);
> qemu_loadvm_state_cleanup();
> - return -EINVAL;
> + return -1;
> }
> ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state,
> 0);
>
> if (ret) {
> + error_setg(errp, "Error %d while loading VM state", ret);
error_setg_errno(), otherwise:
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
> qemu_loadvm_state_cleanup();
> - return ret;
> + return -1;
> }
> }
> return 0;