Skip to content

Commit

Permalink
migration: add "return-path" capability
Browse files Browse the repository at this point in the history
When this capability is enabled, QEMU will use the return path even for
precopy migration. This is helpful at least in one case when destination
failed to load the image while source quited without confirmation. With
return path, source will wait for the last response from destination,
and if destination fails, it'll fail the migration on source, then the
guest can be run again on the source (rather than assuming to be good,
then the guest will be lost after source quits).

It needs to be enabled explicitly on source, otherwise disabled.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
  • Loading branch information
xzpeter authored and Juan Quintela committed Jun 28, 2017
1 parent d2164ad commit c788ada
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 13 additions & 3 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,15 @@ bool migrate_use_block(void)
return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK];
}

bool migrate_use_return_path(void)
{
MigrationState *s;

s = migrate_get_current();

return s->enabled_capabilities[MIGRATION_CAPABILITY_RETURN_PATH];
}

bool migrate_use_block_incremental(void)
{
MigrationState *s;
Expand Down Expand Up @@ -1975,10 +1984,11 @@ void migrate_fd_connect(MigrationState *s)
notifier_list_notify(&migration_state_notifiers, s);

/*
* Open the return path; currently for postcopy but other things might
* also want it.
* Open the return path. For postcopy, it is used exclusively. For
* precopy, only if user specified "return-path" capability would
* QEMU uses the return path.
*/
if (migrate_postcopy_ram()) {
if (migrate_postcopy_ram() || migrate_use_return_path()) {
if (open_return_path_on_source(s)) {
error_report("Unable to open return-path for postcopy");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
Expand Down
1 change: 1 addition & 0 deletions migration/migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ bool migrate_colo_enabled(void);

bool migrate_use_block(void);
bool migrate_use_block_incremental(void);
bool migrate_use_return_path(void);

bool migrate_use_compression(void);
int migrate_compress_level(void);
Expand Down
5 changes: 4 additions & 1 deletion qapi-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,15 @@
# offers more flexibility.
# (Since 2.10)
#
# @return-path: If enabled, migration will use the return path even
# for precopy. (since 2.10)
#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
'block' ] }
'block', 'return-path' ] }

##
# @MigrationCapabilityStatus:
Expand Down

0 comments on commit c788ada

Please sign in to comment.