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: yilzh...@redhat.com
Cc: Jose Ricardo Ziviani <jos...@linux.vnet.ibm.com>
Signed-off-by: Yasmin Beatriz <yasm...@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

Reply via email to