diff options
mode: <>2009-11-02 15:40:58 +0200
committerAnthony Liguori <>2009-11-17 08:49:30 -0600
commitc163b5cae98be8eda675b96e2dec4707bfa7fbbf (patch)
tree7c50d7a326b72c6aa1906e4055ecf049d667fad1 /migration.c
parentExpose a mechanism to trace block writes (diff)
Block live migration
This patch introduces block migration called during live migration. Block are being copied to the destination in an async way. First the code will transfer the whole disk and then transfer all dirty blocks accumulted during the migration. Still need to improve transition from the iterative phase of migration to the end phase. For now transition will take place when all blocks transfered once, all the dirty blocks will be transfered during the end phase (guest is suspended). Changes from v4: - Global variabels moved to a global state structure allocated dynamically. - Minor coding style issues. - Poll block.c for tracking of dirty blocks instead of manage it here. Signed-off-by: Liran Schour <> Signed-off-by: Anthony Liguori <>
Diffstat (limited to 'migration.c')
1 files changed, 16 insertions, 7 deletions
diff --git a/migration.c b/migration.c
index b20beb730..3ae0be86c 100644
--- a/migration.c
+++ b/migration.c
@@ -58,16 +58,24 @@ void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
const char *p;
int detach = qdict_get_int(qdict, "detach");
const char *uri = qdict_get_str(qdict, "uri");
if (strstart(uri, "tcp:", &p))
- s = tcp_start_outgoing_migration(p, max_throttle, detach);
+ s = tcp_start_outgoing_migration(p, max_throttle, detach,
+ (int)qdict_get_int(qdict, "blk"),
+ (int)qdict_get_int(qdict, "inc"));
#if !defined(WIN32)
else if (strstart(uri, "exec:", &p))
- s = exec_start_outgoing_migration(p, max_throttle, detach);
+ s = exec_start_outgoing_migration(p, max_throttle, detach,
+ (int)qdict_get_int(qdict, "blk"),
+ (int)qdict_get_int(qdict, "inc"));
else if (strstart(uri, "unix:", &p))
- s = unix_start_outgoing_migration(p, max_throttle, detach);
+ s = unix_start_outgoing_migration(p, max_throttle, detach,
+ (int)qdict_get_int(qdict, "blk"),
+ (int)qdict_get_int(qdict, "inc"));
else if (strstart(uri, "fd:", &p))
- s = fd_start_outgoing_migration(mon, p, max_throttle, detach);
+ s = fd_start_outgoing_migration(mon, p, max_throttle, detach,
+ (int)qdict_get_int(qdict, "blk"),
+ (int)qdict_get_int(qdict, "inc"));
monitor_printf(mon, "unknown migration protocol: %s\n", uri);
@@ -251,13 +259,14 @@ void migrate_fd_connect(FdMigrationState *s)
dprintf("beginning savevm\n");
- ret = qemu_savevm_state_begin(s->file);
+ ret = qemu_savevm_state_begin(s->file, s->mig_state.blk,
+ s->mig_state.shared);
if (ret < 0) {
dprintf("failed, %d\n", ret);