diff mbox

[1/1] Disallow outward migration while awaiting incoming migration

Message ID 1397488563-14131-1-git-send-email-dgilbert@redhat.com
State New
Headers show

Commit Message

Dr. David Alan Gilbert April 14, 2014, 3:16 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@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 <dgilbert@redhat.com>
---
 include/qapi/qmp/qerror.h | 3 +++
 migration.c               | 5 +++++
 2 files changed, 8 insertions(+)

Comments

Andreas Färber April 14, 2014, 3:34 p.m. UTC | #1
Am 14.04.2014 17:16, schrieb Dr. David Alan Gilbert (git):
> From: "Dr. David Alan Gilbert" <dgilbert@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 <dgilbert@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);

Shouldn't this be using error_setg() instead of a new QERR_?

Andreas

> +        return;
> +    }
> +
>      if (qemu_savevm_state_blocked(errp)) {
>          return;
>      }
diff mbox

Patch

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;
     }