aboutsummaryrefslogtreecommitdiff
path: root/block-migration.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-06-28 15:11:57 +0200
committerJuan Quintela <quintela@redhat.com>2012-07-20 08:19:27 +0200
commitd1315aac6e4df1f472a6f87ef6e310b8c109f498 (patch)
treef8cdca807d155698e2399306dbec7892b363dd9b /block-migration.c
parent6bd68781331590c4f2fbd1fdf98e80d7f6588b31 (diff)
savevm: split save_live_setup from save_live_state
This patch splits stage 1 to its own function for both save_live users, ram and block. It is just a copy of the function, removing the parts of the other stages. Optimizations would came later. Signed-off-by: Juan Quintela <quintela@redhat.com>
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,