aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-10-27 04:22:57 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-12-10 12:15:14 -0500
commite69d50d621ccc1ab8b1048a3075ad944afebfed5 (patch)
treeb5051df8b4510f3d0392e339759100e90106f5f4 /migration/migration.c
parentcca686b44aa1315df4cda4dee56ca601050fab71 (diff)
downloadqemu-e69d50d621ccc1ab8b1048a3075ad944afebfed5.zip
qemu-e69d50d621ccc1ab8b1048a3075ad944afebfed5.tar.gz
qemu-e69d50d621ccc1ab8b1048a3075ad944afebfed5.tar.bz2
migration, vl: start migration via qmp_migrate_incoming
Make qemu_start_incoming_migration local to migration/migration.c. By using the runstate instead of a separate flag, vl need not do anything to setup deferred incoming migration. qmp_migrate_incoming also does not need the deferred_incoming flag anymore, because "-incoming PROTOCOL" will clear the "once" flag before the main loop starts. Therefore, later invocations of the migrate-incoming command will fail with the existing "The incoming migration has already been started" error message. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/migration/migration.c b/migration/migration.c
index d9e94f4..e0dbde4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -118,8 +118,6 @@
static NotifierList migration_state_notifiers =
NOTIFIER_LIST_INITIALIZER(migration_state_notifiers);
-static bool deferred_incoming;
-
/* Messages sent on the return path from destination to source */
enum mig_rp_message_type {
MIG_RP_MSG_INVALID = 0, /* Must be 0 */
@@ -276,19 +274,6 @@ static bool migrate_late_block_activate(void)
}
/*
- * Called on -incoming with a defer: uri.
- * The migration can be started later after any parameters have been
- * changed.
- */
-static void deferred_incoming_migration(Error **errp)
-{
- if (deferred_incoming) {
- error_setg(errp, "Incoming migration already deferred");
- }
- deferred_incoming = true;
-}
-
-/*
* Send a message on the return channel back to the source
* of the migration.
*/
@@ -429,16 +414,14 @@ void migrate_add_address(SocketAddress *address)
addrs->value = QAPI_CLONE(SocketAddress, address);
}
-void qemu_start_incoming_migration(const char *uri, Error **errp)
+static void qemu_start_incoming_migration(const char *uri, Error **errp)
{
const char *p = NULL;
qapi_event_send_migration(MIGRATION_STATUS_SETUP);
- if (!strcmp(uri, "defer")) {
- deferred_incoming_migration(errp);
- } else if (strstart(uri, "tcp:", &p) ||
- strstart(uri, "unix:", NULL) ||
- strstart(uri, "vsock:", NULL)) {
+ if (strstart(uri, "tcp:", &p) ||
+ strstart(uri, "unix:", NULL) ||
+ strstart(uri, "vsock:", NULL)) {
socket_start_incoming_migration(p ? p : uri, errp);
#ifdef CONFIG_RDMA
} else if (strstart(uri, "rdma:", &p)) {
@@ -1988,14 +1971,14 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
Error *local_err = NULL;
static bool once = true;
- if (!deferred_incoming) {
- error_setg(errp, "For use with '-incoming defer'");
- return;
- }
if (!once) {
error_setg(errp, "The incoming migration has already been started");
return;
}
+ if (!runstate_check(RUN_STATE_INMIGRATE)) {
+ error_setg(errp, "'-incoming' was not specified on the command line");
+ return;
+ }
qemu_start_incoming_migration(uri, &local_err);