qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: reflect incoming failure to shell
@ 2013-04-16 21:50 Eric Blake
  2013-04-16 22:03 ` Anthony Liguori
  2013-04-22 18:35 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Blake @ 2013-04-16 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, pbonzini, phrdina, quintela

Management apps like libvirt don't know to pay attention to
stderr unless there is a non-zero exit status.

* migration.c (process_incoming_migration_co): Exit with non-zero
status on failure.

Signed-off-by: Eric Blake <eblake@redhat.com>
---

Noticed while reviewing:
https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03293.html
and it seems blatant enough to fix now, rather than waiting for
Pavel's series to stabilize.

Side note: libvirt explicitly forbids all use of exit({0,1}), and
instead encourages exit(EXIT_{SUCCESS,FAILURE}), precisely because
it makes it harder to slip in unintentional successful exits.

 migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration.c b/migration.c
index 3b4b467..3eb0fad 100644
--- a/migration.c
+++ b/migration.c
@@ -99,7 +99,7 @@ static void process_incoming_migration_co(void *opaque)
     qemu_fclose(f);
     if (ret < 0) {
         fprintf(stderr, "load of migration failed\n");
-        exit(0);
+        exit(EXIT_FAILURE);
     }
     qemu_announce_self();
     DPRINTF("successfully loaded vm state\n");
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] migration: reflect incoming failure to shell
  2013-04-16 21:50 [Qemu-devel] [PATCH] migration: reflect incoming failure to shell Eric Blake
@ 2013-04-16 22:03 ` Anthony Liguori
  2013-04-22 18:35 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2013-04-16 22:03 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: qemu-trivial, pbonzini, phrdina, Stefan Hajnoczi, quintela

Eric Blake <eblake@redhat.com> writes:

> Management apps like libvirt don't know to pay attention to
> stderr unless there is a non-zero exit status.
>
> * migration.c (process_incoming_migration_co): Exit with non-zero
> status on failure.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>

It looks like the migration coroutine cleans itself so there's no
obvious way to propagate the error.  A nicer cleanup would be to switch
the fprintf to error_report() too but this is certainly better than what
we have now.

Maybe we need an error_report_fatal()...

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori


> ---
>
> Noticed while reviewing:
> https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg03293.html
> and it seems blatant enough to fix now, rather than waiting for
> Pavel's series to stabilize.
>
> Side note: libvirt explicitly forbids all use of exit({0,1}), and
> instead encourages exit(EXIT_{SUCCESS,FAILURE}), precisely because
> it makes it harder to slip in unintentional successful exits.
>
>  migration.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration.c b/migration.c
> index 3b4b467..3eb0fad 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -99,7 +99,7 @@ static void process_incoming_migration_co(void *opaque)
>      qemu_fclose(f);
>      if (ret < 0) {
>          fprintf(stderr, "load of migration failed\n");
> -        exit(0);
> +        exit(EXIT_FAILURE);
>      }
>      qemu_announce_self();
>      DPRINTF("successfully loaded vm state\n");
> -- 
> 1.8.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] migration: reflect incoming failure to shell
  2013-04-16 21:50 [Qemu-devel] [PATCH] migration: reflect incoming failure to shell Eric Blake
  2013-04-16 22:03 ` Anthony Liguori
@ 2013-04-22 18:35 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2013-04-22 18:35 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: qemu-trivial, pbonzini, phrdina, Stefan Hajnoczi, quintela

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-22 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 21:50 [Qemu-devel] [PATCH] migration: reflect incoming failure to shell Eric Blake
2013-04-16 22:03 ` Anthony Liguori
2013-04-22 18:35 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).