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

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

 



On Thu, Jan 07, 2016 at 10:30:49AM +1100, Michael Chapman wrote:
On Wed, 6 Jan 2016, Martin Kletzander wrote:
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?

I was rebooting a hypervisor with running guests. My libvirt-guests config
has:

ON_SHUTDOWN=shutdown
PARALLEL_SHUTDOWN=8

I noticed it was taking an awful long time to reboot. What had happened
was that it had hit the error path in check_guests_shutdown, so
shutdown_guests_parallel was stuck looping over:

virsh domid Failed
virsh domid to
virsh domid determine
virsh domid state
virsh domid of
virsh domid guest
...

The error message had been printed to stdout, so it got captured as the
list of guests still needing to be shutdown.

I could have just fixed that one error case (but how? Not use $(...)
captures?), but I decided to change them all since it seemed likely that
this problem might crop up again in the future.

Can you think of an alternative approach? I hadn't considered the case
of systems redirecting only stdout from initscripts.


So sorry for not responding to this for so long.  I would just say keep
all the messages to stdout and output one error message (doesn't have to
be from virsh, just 'echo $msg 2>&1' will suffice) to stderr for each
domain that we failed to stop/start.

I did not mean to hinder the fix by any means, sorry for that once
again.  I'd be more than happy to merge fixes for the script upstream.

Thanks,
Martin

Attachment: signature.asc
Description: Digital signature

--
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]