[libvirt] [PATCH] libvirt-guests: emit most messages to stderr

Martin Kletzander mkletzan at redhat.com
Wed Jan 6 14:10:07 UTC 2016


On Thu, Dec 31, 2015 at 04:53:54PM +1100, Michael Chapman wrote:
>Some of the shell functions in this script (e.g. check_guests_shutdown)
>produce output that is captured and processed by other parts of the
>script. Any error messages from these shell functions must go to stderr,
>not stdout.
>
>Rather than trying to determine which messages are safe for stdout and
>which are not (and maintaining this safety as the script is refactored),
>simplify things by emitting all messages to stderr, except for the
>output from gueststatus(), rh_status() and usage().
>

This is a good idea, but I just simply changing all outputs to stderr
seems wrong.  It doesn't matter for systemd systems, I guess, we output
everything to stdout currently and it goes to the logs anyway.  But for
other systems it might pollute the output with just informative
messages.  For example on my system I would see stderr but not stdout
(that goes to its logfile).  What is the reasoning behind this change?
Why can't we keep everything on stdout?

>Signed-off-by: Michael Chapman <mike at very.puzzling.org>
>---
> tools/libvirt-guests.sh.in | 94 +++++++++++++++++++++++-----------------------
> 1 file changed, 47 insertions(+), 47 deletions(-)
>
>diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
>index 7f74b85..80b1ec7 100644
>--- a/tools/libvirt-guests.sh.in
>+++ b/tools/libvirt-guests.sh.in
>@@ -92,16 +92,16 @@ test_connect()
>
>     i=${CONNECT_RETRIES}
>     while [ $i -gt 0 ]; do
>-        run_virsh "$uri" connect 2>/dev/null
>+        run_virsh "$uri" connect >/dev/null 2>/dev/null

This could be fixed no matter how we decide to proceed with the rest.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160106/098c5e21/attachment-0001.sig>


More information about the libvir-list mailing list