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 */
MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
}
-/*
- * 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.
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)) {
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);
#include "qapi/qapi-visit-block-core.h"
#include "qapi/qapi-visit-ui.h"
#include "qapi/qapi-commands-block-core.h"
+#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
}
if (incoming) {
Error *local_err = NULL;
- qemu_start_incoming_migration(incoming, &local_err);
- if (local_err) {
- error_reportf_err(local_err, "-incoming %s: ", incoming);
- exit(1);
+ if (strcmp(incoming, "defer") != 0) {
+ qmp_migrate_incoming(incoming, &local_err);
+ if (local_err) {
+ error_reportf_err(local_err, "-incoming %s: ", incoming);
+ exit(1);
+ }
}
} else if (autostart) {
vm_start();