[Qemu-devel] [PATCH 12/17] migration: Pass local error object pointer to error_append_hint()

Greg Kurz posted 17 patches 6 years, 1 month ago
Maintainers: Yuval Shaia <yuval.shaia@oracle.com>, Eric Blake <eblake@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Markus Armbruster <armbru@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, John Snow <jsnow@redhat.com>, Fam Zheng <fam@euphon.net>, Richard Henderson <rth@twiddle.net>, Jeff Cody <codyprime@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Gerd Hoffmann <kraxel@redhat.com>, Max Reitz <mreitz@redhat.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eric Farman <farman@linux.ibm.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Juan Quintela <quintela@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, David Hildenbrand <david@redhat.com>, Cornelia Huck <cohuck@redhat.com>
[Qemu-devel] [PATCH 12/17] migration: Pass local error object pointer to error_append_hint()
Posted by Greg Kurz 6 years, 1 month ago
Ensure that hints are added even if errp is &error_fatal or &error_abort.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 migration/migration.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 01863a95f5fe..6724173ce34e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -983,18 +983,24 @@ static bool migrate_caps_check(bool *cap_list,
 
 #ifndef CONFIG_LIVE_BLOCK_MIGRATION
     if (cap_list[MIGRATION_CAPABILITY_BLOCK]) {
-        error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i) "
+        Error *local_err = NULL;
+
+        error_setg(&local_err, "QEMU compiled without old-style (blk/-b, inc/-i) "
                    "block migration");
-        error_append_hint(errp, "Use drive_mirror+NBD instead.\n");
+        error_append_hint(&local_err, "Use drive_mirror+NBD instead.\n");
+        error_propagate(errp, local_err);
         return false;
     }
 #endif
 
 #ifndef CONFIG_REPLICATION
     if (cap_list[MIGRATION_CAPABILITY_X_COLO]) {
-        error_setg(errp, "QEMU compiled without replication module"
+        Error *local_err = NULL;
+
+        error_setg(&local_err, "QEMU compiled without replication module"
                    " can't enable COLO");
-        error_append_hint(errp, "Please enable replication before COLO.\n");
+        error_append_hint(&local_err, "Please enable replication before COLO.\n");
+        error_propagate(errp, local_err);
         return false;
     }
 #endif


Re: [Qemu-devel] [PATCH 12/17] migration: Pass local error object pointer to error_append_hint()
Posted by Dr. David Alan Gilbert 6 years, 1 month ago
* Greg Kurz (groug@kaod.org) wrote:
> Ensure that hints are added even if errp is &error_fatal or &error_abort.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

A bit painful, but if it solves the problem,


Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/migration.c |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 01863a95f5fe..6724173ce34e 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -983,18 +983,24 @@ static bool migrate_caps_check(bool *cap_list,
>  
>  #ifndef CONFIG_LIVE_BLOCK_MIGRATION
>      if (cap_list[MIGRATION_CAPABILITY_BLOCK]) {
> -        error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i) "
> +        Error *local_err = NULL;
> +
> +        error_setg(&local_err, "QEMU compiled without old-style (blk/-b, inc/-i) "
>                     "block migration");
> -        error_append_hint(errp, "Use drive_mirror+NBD instead.\n");
> +        error_append_hint(&local_err, "Use drive_mirror+NBD instead.\n");
> +        error_propagate(errp, local_err);
>          return false;
>      }
>  #endif
>  
>  #ifndef CONFIG_REPLICATION
>      if (cap_list[MIGRATION_CAPABILITY_X_COLO]) {
> -        error_setg(errp, "QEMU compiled without replication module"
> +        Error *local_err = NULL;
> +
> +        error_setg(&local_err, "QEMU compiled without replication module"
>                     " can't enable COLO");
> -        error_append_hint(errp, "Please enable replication before COLO.\n");
> +        error_append_hint(&local_err, "Please enable replication before COLO.\n");
> +        error_propagate(errp, local_err);
>          return false;
>      }
>  #endif
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK