migration: push Error **errp into vmstate_load_state()
This is an incremental step in converting vmstate loading code to report error via Error objects instead of directly printing it to console/monitor. It is ensured that vmstate_load_state() must report an error in errp, in case of failure. The errors are temporarily reported using error_report_err(). This is removed in the subsequent patches in this series, when we are actually able to propagate the error to the calling function using errp. Whereas, if we want the function to exit on error, then error_fatal is passed. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Arun Menon <armenon@redhat.com> Tested-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Link: https://lore.kernel.org/r/20250918-propagate_tpm_error-v14-2-36f11a6fb9d3@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
73b42fc58d
commit
c632ffbd74
15 changed files with 143 additions and 55 deletions
|
|
@ -1001,6 +1001,7 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
|
|||
VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(pv);
|
||||
struct CBInfoArray cbinfo = {};
|
||||
int i, ret;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!have_clipboard(vd)) {
|
||||
return 0;
|
||||
|
|
@ -1008,8 +1009,10 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t size,
|
|||
|
||||
vdagent_clipboard_peer_register(vd);
|
||||
|
||||
ret = vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0);
|
||||
ret = vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0,
|
||||
&local_err);
|
||||
if (ret) {
|
||||
error_report_err(local_err);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue