Skip to content

Commit

Permalink
Migration: Recovering pages lost due to n/w failure during pc migrati…
Browse files Browse the repository at this point in the history
…on (source)

Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
  • Loading branch information
harisphnx committed Aug 21, 2016
1 parent b57c998 commit ea4f38c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/migration/migration.h
Expand Up @@ -145,6 +145,11 @@ struct MigrationState
int state;
/* Old style params from 'migrate' command */
MigrationParams params;
/*
* Don't need 2 variables for recovery.
* Clean this up, use a single variable with different states.
*/
bool recovered_once;
bool in_recovery;

/* State related to return path */
Expand Down
2 changes: 2 additions & 0 deletions migration/migration.c
Expand Up @@ -1042,6 +1042,7 @@ MigrationState *migrate_init(const MigrationParams *params)
s->xfer_limit = 0;
s->cleanup_bh = 0;
s->to_dst_file = NULL;
s->recovered_once = false;
s->in_recovery = false;
s->state = MIGRATION_STATUS_NONE;
s->params = *params;
Expand Down Expand Up @@ -1925,6 +1926,7 @@ static void *migration_thread(void *opaque)
if(ret == 0) {
current_active_state = MIGRATION_STATUS_POSTCOPY_ACTIVE;
runstate_set(RUN_STATE_FINISH_MIGRATE);
s->recovered_once = true;
qemu_file_clear_error(s->to_dst_file);
continue;
}
Expand Down
5 changes: 5 additions & 0 deletions migration/savevm.c
Expand Up @@ -986,6 +986,11 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
{
SaveStateEntry *se;
int ret;
MigrationState *ms = migrate_get_current();

if (ms->recovered_once) {
qemu_savevm_command_send(f, MIG_CMD_POSTCOPY_RECOVERY, 0, NULL);
}

QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
if (!se->ops || !se->ops->save_live_complete_postcopy) {
Expand Down

0 comments on commit ea4f38c

Please sign in to comment.