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: yilzh...@redhat.com
Cc: Jose Ricardo Ziviani <jos...@linux.vnet.ibm.com>
Signed-off-by: Yasmin Beatriz <yasm...@linux.vnet.ibm.com>
---
  dump.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Daniel Henrique Barboza <danie...@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;
      }


Reply via email to