We delay dealing with actual errors until a later, more
appropriate time in general, but if we wanted to do the same
with warnings we'd have to introduce a lot of duplicated
handling in virsh, so we just print them right away and move
on with the usual processing instead.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 tools/vsh.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/vsh.c b/tools/vsh.c
index 9ea3c4b96a..2ebd11d09f 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -242,6 +242,9 @@ vshErrorHandler(void *opaque ATTRIBUTE_UNUSED,
 {
     virFreeError(last_error);
     last_error = virSaveLastError();
+
+    if (last_error && last_error->level == VIR_ERR_WARNING)
+        fprintf(stderr, "Warning: %s\n", NULLSTR(last_error->message));
 }
 
 /* Store a libvirt error that is from a helper API that doesn't raise errors
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to