mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-15 07:22:46 +00:00
migration: Always report an error in ram_save_setup()
This will prepare ground for future changes adding an Error** argument to the save_setup() handler. We need to make sure that on failure, ram_save_setup() sets a new error. Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20240320064911.545001-5-clg@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
150da48cb2
commit
76936bbc31
|
@ -3074,12 +3074,14 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
||||||
int ret, max_hg_page_size;
|
int ret, max_hg_page_size;
|
||||||
|
|
||||||
if (compress_threads_save_setup()) {
|
if (compress_threads_save_setup()) {
|
||||||
|
error_report("%s: failed to start compress threads", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* migration has already setup the bitmap, reuse it. */
|
/* migration has already setup the bitmap, reuse it. */
|
||||||
if (!migration_in_colo_state()) {
|
if (!migration_in_colo_state()) {
|
||||||
if (ram_init_all(rsp) != 0) {
|
if (ram_init_all(rsp) != 0) {
|
||||||
|
error_report("%s: failed to setup RAM for migration", __func__);
|
||||||
compress_threads_save_cleanup();
|
compress_threads_save_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3116,12 +3118,14 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
||||||
|
|
||||||
ret = rdma_registration_start(f, RAM_CONTROL_SETUP);
|
ret = rdma_registration_start(f, RAM_CONTROL_SETUP);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
error_report("%s: failed to start RDMA registration", __func__);
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rdma_registration_stop(f, RAM_CONTROL_SETUP);
|
ret = rdma_registration_stop(f, RAM_CONTROL_SETUP);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
error_report("%s: failed to stop RDMA registration", __func__);
|
||||||
qemu_file_set_error(f, ret);
|
qemu_file_set_error(f, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3138,6 +3142,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
||||||
ret = multifd_send_sync_main();
|
ret = multifd_send_sync_main();
|
||||||
bql_lock();
|
bql_lock();
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
error_report("%s: multifd synchronization failed", __func__);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3147,7 +3152,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
|
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
|
||||||
return qemu_fflush(f);
|
ret = qemu_fflush(f);
|
||||||
|
if (ret < 0) {
|
||||||
|
error_report("%s failed : %s", __func__, strerror(-ret));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ram_save_file_bmap(QEMUFile *f)
|
static void ram_save_file_bmap(QEMUFile *f)
|
||||||
|
|
Loading…
Reference in a new issue