From: "Dr. David Alan Gilbert" <dgilb...@redhat.com>

QEMU will assert if you attempt to start an outgoing migration on
a QEMU that's sitting waiting for an incoming migration (started
with -incoming), so disallow it with a proper error.

(This is a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1086987 )

Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com>
---
 include/qapi/qmp/qerror.h | 3 +++
 migration.c               | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index da75abf..03103cc 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -167,6 +167,9 @@ void qerror_report_err(Error *err);
 #define QERR_MIGRATION_NOT_SUPPORTED \
     ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
 
+#define QERR_MIGRATION_ON_INCOMING \
+    ERROR_CLASS_GENERIC_ERROR, "Guest is waiting for an incoming migration"
+
 #define QERR_MISSING_PARAMETER \
     ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
 
diff --git a/migration.c b/migration.c
index bd1fb91..e99b5fa 100644
--- a/migration.c
+++ b/migration.c
@@ -419,6 +419,11 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         return;
     }
 
+    if (runstate_check(RUN_STATE_INMIGRATE)) {
+        error_set(errp, QERR_MIGRATION_ON_INCOMING);
+        return;
+    }
+
     if (qemu_savevm_state_blocked(errp)) {
         return;
     }
-- 
1.9.0


Reply via email to