[libvirt] [PATCH 2/3] virfile: Report error in virFileWrapperFdFree()

Andrea Bolognani abologna at redhat.com
Tue Feb 5 15:16:22 UTC 2019


Logging the error is fine and all, but getting the information
to the user directly is even better.

https://bugzilla.redhat.com/show_bug.cgi?id=1578741
Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/util/virfile.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index 271bf5e796..30cad87df9 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -351,8 +351,12 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd)
     if (!wfd)
         return;
 
+    /* If the command used to process IO has produced errors, it's fair
+     * to assume those will be more relevant to the user than whatever
+     * eg. QEMU can figure out on its own, so it's okay if we end up
+     * discarding an existing error */
     if (wfd->err_msg && *wfd->err_msg)
-        VIR_WARN("iohelper reports: %s", wfd->err_msg);
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s", wfd->err_msg);
 
     virCommandAbort(wfd->cmd);
 
-- 
2.20.1




More information about the libvir-list mailing list