[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH] dump: Show custom message for EN

From: Eric Blake
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] dump: Show custom message for ENOSPC
Date: Fri, 9 Feb 2018 14:52:59 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 02/09/2018 01:31 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: address@hidden
Cc: Jose Ricardo Ziviani <address@hidden>
Signed-off-by: Yasmin Beatriz <address@hidden>
  dump.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dump.c b/dump.c
index e9dfed060a..eb56ff53f6 100644
--- a/dump.c
+++ b/dump.c
@@ -106,6 +106,9 @@ 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) {
+        if (errno == ENOSPC) {
+            return -ENOSPC;
+        }
          return -1;

Mixing a return of -1 and negative errno is ugly (as -1 is indistinguishable from -EPERM on many, but not all, operating systems). If you need to distinguish between different error types, then return negative errno in all places.

@@ -364,7 +367,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");

Or, if you really want better error messages, it might make sense to push errp setting down into fd_write_vmcore() (all callers have to be updated).

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]