Skip to content

Commit

Permalink
migration: enforce multifd and postcopy preempt to be set before inco…
Browse files Browse the repository at this point in the history
…ming

qemu_start_incoming_migration needs to check the number of multifd
channels or postcopy ram channels to configure the backlog parameter (i.e.
the maximum length to which the queue of pending connections for sockfd
may grow) of listen(). So enforce the usage of postcopy-preempt and
multifd as below:
- need to use "-incoming defer" on the destination; and
- set_capability and set_parameter need to be done before migrate_incoming

Otherwise, disable the use of the features and report error messages to
remind users to adjust the commands.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20230606101910.20456-2-wei.w.wang@intel.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
  • Loading branch information
wei-w-wang authored and Juan Quintela committed Jul 26, 2023
1 parent 908927d commit 82137e6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions migration/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot,
MIGRATION_CAPABILITY_VALIDATE_UUID,
MIGRATION_CAPABILITY_ZERO_COPY_SEND);

static bool migrate_incoming_started(void)
{
return !!migration_incoming_get_current()->transport_data;
}

/**
* @migration_caps_check - check capability compatibility
*
Expand Down Expand Up @@ -564,13 +569,23 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
error_setg(errp, "Postcopy preempt not compatible with compress");
return false;
}

if (migrate_incoming_started()) {
error_setg(errp,
"Postcopy preempt must be set before incoming starts");
return false;
}
}

if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) {
if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) {
error_setg(errp, "Multifd is not compatible with compress");
return false;
}
if (migrate_incoming_started()) {
error_setg(errp, "Multifd must be set before incoming starts");
return false;
}
}

if (new_caps[MIGRATION_CAPABILITY_SWITCHOVER_ACK]) {
Expand Down

0 comments on commit 82137e6

Please sign in to comment.