aboutsummaryrefslogtreecommitdiff
path: root/block-migration.c
diff options
context:
space:
mode:
Diffstat (limited to 'block-migration.c')
-rw-r--r--block-migration.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/block-migration.c b/block-migration.c
index 6d37dc157c..fc3d1f46c6 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -541,20 +541,40 @@ static void block_migration_cancel(void *opaque)
blk_mig_cleanup();
}
-static int block_save_live(QEMUFile *f, int stage, void *opaque)
+static int block_save_setup(QEMUFile *f, void *opaque)
{
int ret;
- DPRINTF("Enter save live stage %d submitted %d transferred %d\n",
- stage, block_mig_state.submitted, block_mig_state.transferred);
+ DPRINTF("Enter save live setup submitted %d transferred %d\n",
+ block_mig_state.submitted, block_mig_state.transferred);
- if (stage == 1) {
- init_blk_migration(f);
+ init_blk_migration(f);
+
+ /* start track dirty blocks */
+ set_dirty_tracking(1);
+
+ flush_blks(f);
- /* start track dirty blocks */
- set_dirty_tracking(1);
+ ret = qemu_file_get_error(f);
+ if (ret) {
+ blk_mig_cleanup();
+ return ret;
}
+ blk_mig_reset_dirty_cursor();
+
+ qemu_put_be64(f, BLK_MIG_FLAG_EOS);
+
+ return 0;
+}
+
+static int block_save_live(QEMUFile *f, int stage, void *opaque)
+{
+ int ret;
+
+ DPRINTF("Enter save live stage %d submitted %d transferred %d\n",
+ stage, block_mig_state.submitted, block_mig_state.transferred);
+
flush_blks(f);
ret = qemu_file_get_error(f);
@@ -710,6 +730,7 @@ static bool block_is_active(void *opaque)
SaveVMHandlers savevm_block_handlers = {
.set_params = block_set_params,
+ .save_live_setup = block_save_setup,
.save_live_state = block_save_live,
.load_state = block_load,
.cancel = block_migration_cancel,