All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC
@ 2018-02-09 20:26 Yasmin Beatriz
  2018-02-09 20:32 ` Daniel Henrique Barboza
  2018-02-09 20:57 ` Eric Blake
  0 siblings, 2 replies; 4+ messages in thread
From: Yasmin Beatriz @ 2018-02-09 20:26 UTC (permalink / raw)
  To: qemu-devel, Marc-André Lureau; +Cc: qemu-trivial, joserz

This patch intends to make a more specific message for when
the system has not enough space to save guest memory.

Reported-by: yilzhang@redhat.com
Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Signed-off-by: Yasmin Beatriz <yasmins@linux.vnet.ibm.com>
---
 dump.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dump.c b/dump.c
index e9dfed060a..12e0c779ee 100644
--- a/dump.c
+++ b/dump.c
@@ -106,7 +106,7 @@ static int fd_write_vmcore(const void *buf, size_t size, void *opaque)
 
     written_size = qemu_write_full(s->fd, buf, size);
     if (written_size != size) {
-        return -1;
+        return -errno;
     }
 
     return 0;
@@ -364,7 +364,11 @@ static void write_data(DumpState *s, void *buf, int length, Error **errp)
 
     ret = fd_write_vmcore(buf, length, s);
     if (ret < 0) {
-        error_setg(errp, "dump: failed to save memory");
+        if (ret == -ENOSPC) {
+            error_setg(errp, "dump: not enough space to save memory");
+        } else {
+            error_setg(errp, "dump: failed to save memory");
+        }
     } else {
         s->written_size += length;
     }
-- 
2.14.1

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

* Re: [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC
  2018-02-09 20:26 [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC Yasmin Beatriz
@ 2018-02-09 20:32 ` Daniel Henrique Barboza
  2018-02-09 20:57 ` Eric Blake
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2018-02-09 20:32 UTC (permalink / raw)
  To: Yasmin Beatriz, qemu-devel, Marc-André Lureau; +Cc: qemu-trivial, joserz



On 02/09/2018 06:26 PM, Yasmin Beatriz wrote:
> This patch intends to make a more specific message for when
> the system has not enough space to save guest memory.
>
> Reported-by: yilzhang@redhat.com
> Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
> Signed-off-by: Yasmin Beatriz <yasmins@linux.vnet.ibm.com>
> ---
>   dump.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>

> diff --git a/dump.c b/dump.c
> index e9dfed060a..12e0c779ee 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -106,7 +106,7 @@ static int fd_write_vmcore(const void *buf, size_t size, void *opaque)
>
>       written_size = qemu_write_full(s->fd, buf, size);
>       if (written_size != size) {
> -        return -1;
> +        return -errno;
>       }
>
>       return 0;
> @@ -364,7 +364,11 @@ static void write_data(DumpState *s, void *buf, int length, Error **errp)
>
>       ret = fd_write_vmcore(buf, length, s);
>       if (ret < 0) {
> -        error_setg(errp, "dump: failed to save memory");
> +        if (ret == -ENOSPC) {
> +            error_setg(errp, "dump: not enough space to save memory");
> +        } else {
> +            error_setg(errp, "dump: failed to save memory");
> +        }
>       } else {
>           s->written_size += length;
>       }

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

* Re: [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC
  2018-02-09 20:26 [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC Yasmin Beatriz
  2018-02-09 20:32 ` Daniel Henrique Barboza
@ 2018-02-09 20:57 ` Eric Blake
  2018-02-09 21:36   ` joserz
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2018-02-09 20:57 UTC (permalink / raw)
  To: Yasmin Beatriz, qemu-devel, Marc-André Lureau; +Cc: qemu-trivial, joserz

On 02/09/2018 02:26 PM, Yasmin Beatriz wrote:
> This patch intends to make a more specific message for when
> the system has not enough space to save guest memory.
> 
> Reported-by: yilzhang@redhat.com
> Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
> Signed-off-by: Yasmin Beatriz <yasmins@linux.vnet.ibm.com>
> ---

> @@ -364,7 +364,11 @@ static void write_data(DumpState *s, void *buf, int length, Error **errp)
>   
>       ret = fd_write_vmcore(buf, length, s);
>       if (ret < 0) {
> -        error_setg(errp, "dump: failed to save memory");
> +        if (ret == -ENOSPC) {
> +            error_setg(errp, "dump: not enough space to save memory");
> +        } else {
> +            error_setg(errp, "dump: failed to save memory");
> +        }

Why is this caller the only one in the file that gets distinguished 
error messages?  And why not use error_setg_errno() instead of 
open-coding just one special errno value?  If you're changing the return 
value of fd_write_vmcore() anyways, I'd suggest that ALL callers in the 
file be updated to use error_setg_errno().

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

* Re: [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC
  2018-02-09 20:57 ` Eric Blake
@ 2018-02-09 21:36   ` joserz
  0 siblings, 0 replies; 4+ messages in thread
From: joserz @ 2018-02-09 21:36 UTC (permalink / raw)
  To: Eric Blake
  Cc: Yasmin Beatriz, qemu-devel, Marc-André Lureau, qemu-trivial

On Fri, Feb 09, 2018 at 02:57:33PM -0600, Eric Blake wrote:
> On 02/09/2018 02:26 PM, Yasmin Beatriz wrote:
> > This patch intends to make a more specific message for when
> > the system has not enough space to save guest memory.
> > 
> > Reported-by: yilzhang@redhat.com
> > Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
> > Signed-off-by: Yasmin Beatriz <yasmins@linux.vnet.ibm.com>
> > ---
> 
> > @@ -364,7 +364,11 @@ static void write_data(DumpState *s, void *buf, int length, Error **errp)
> >       ret = fd_write_vmcore(buf, length, s);
> >       if (ret < 0) {
> > -        error_setg(errp, "dump: failed to save memory");
> > +        if (ret == -ENOSPC) {
> > +            error_setg(errp, "dump: not enough space to save memory");
> > +        } else {
> > +            error_setg(errp, "dump: failed to save memory");
> > +        }
> 
> Why is this caller the only one in the file that gets distinguished error
> messages?  And why not use error_setg_errno() instead of open-coding just
> one special errno value?  If you're changing the return value of
> fd_write_vmcore() anyways, I'd suggest that ALL callers in the file be
> updated to use error_setg_errno().

Hello Eric, thanks for reviewing it! :)

Yes, only this part has this distiguished error handling because
the whole big amount of data is managed in here, as far as we can tell
it.

It's triggered when you have one of those huge memory guests that
crashes and want to dump its memory into a host that can't offer all
these requirements. AFAIK, other callers doesn't handle so much data,
so we decided to handle only in this part to be the less intrusive
possible.

Your suggestions will be applied then!

> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3266
> Virtualization:  qemu.org | libvirt.org
> 

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

end of thread, other threads:[~2018-02-09 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 20:26 [Qemu-devel] [PATCH v2] dump: Show custom message for ENOSPC Yasmin Beatriz
2018-02-09 20:32 ` Daniel Henrique Barboza
2018-02-09 20:57 ` Eric Blake
2018-02-09 21:36   ` joserz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.