migration: introduce SaveVMHandlers.resume_prepare

This is hook function to be called when a postcopy migration wants to
resume from a failure. For each module, it should provide its own
recovery logic before we switch to the postcopy-active state.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180502104740.12123-16-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Peter Xu 2018-05-02 18:47:31 +08:00 committed by Juan Quintela
parent 13955b89ce
commit d1b8eadbc4
5 changed files with 48 additions and 1 deletions

View file

@ -2454,7 +2454,25 @@ typedef enum MigThrError {
/* Return zero if success, or <0 for error */
static int postcopy_do_resume(MigrationState *s)
{
/* TODO: do the resume logic */
int ret;
/*
* Call all the resume_prepare() hooks, so that modules can be
* ready for the migration resume.
*/
ret = qemu_savevm_state_resume_prepare(s);
if (ret) {
error_report("%s: resume_prepare() failure detected: %d",
__func__, ret);
return ret;
}
/*
* TODO: handshake with dest using MIG_CMD_RESUME,
* MIG_RP_MSG_RESUME_ACK, then switch source state to
* "postcopy-active"
*/
return 0;
}