[RFC 3/7] tools: Print warnings in virsh

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

 



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 <abologna@xxxxxxxxxx>
---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux