summary refs log tree commit diff stats
path: root/include
diff options
context:
space:
mode:
authorAvihai Horon <avihaih@nvidia.com>2023-09-06 18:08:51 +0300
committerCédric Le Goater <clg@redhat.com>2023-09-11 08:34:06 +0200
commit08fc4cb51774f763dcc6fd74637aa9e00eb6a0ba (patch)
treeaf484c052851ff7e63c56196b25ce40e95582db1 /include
parentf543aa222da183ac37424d1ea3a65e5fb6202732 (diff)
downloadfocaccia-qemu-08fc4cb51774f763dcc6fd74637aa9e00eb6a0ba.tar.gz
focaccia-qemu-08fc4cb51774f763dcc6fd74637aa9e00eb6a0ba.zip
migration: Add .save_prepare() handler to struct SaveVMHandlers
Add a new .save_prepare() handler to struct SaveVMHandlers. This handler
is called early, even before migration starts, and can be used by
devices to perform early checks.

Refactor migrate_init() to be able to return errors and call
.save_prepare() from there.

Suggested-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/migration/register.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/migration/register.h b/include/migration/register.h
index 90914f32f5..2b12c6adec 100644
--- a/include/migration/register.h
+++ b/include/migration/register.h
@@ -20,6 +20,11 @@ typedef struct SaveVMHandlers {
     /* This runs inside the iothread lock.  */
     SaveStateHandler *save_state;
 
+    /*
+     * save_prepare is called early, even before migration starts, and can be
+     * used to perform early checks.
+     */
+    int (*save_prepare)(void *opaque, Error **errp);
     void (*save_cleanup)(void *opaque);
     int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
     int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);