From: "Daniel P. Berrange" <berrange@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: pbonzini@redhat.com, Dimitris Aragiorgis <dimara@arrikto.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] log: Redirect stderr to logfile if deamonized
Date: Tue, 1 Mar 2016 11:47:07 +0000 [thread overview]
Message-ID: <20160301114707.GG26728@redhat.com> (raw)
In-Reply-To: <1456830921.23994.14.camel@redhat.com>
On Tue, Mar 01, 2016 at 12:15:21PM +0100, Gerd Hoffmann wrote:
> On Do, 2016-02-18 at 13:38 +0200, Dimitris Aragiorgis wrote:
> > In case of daemonize, use the logfile passed with the -D option in
> > order to redirect stderr to it instead of /dev/null.
> >
> > Also remove some unused code in log.h.
>
> Patch breaks interaction with libvirt. libvirt hangs on startup, while
> probing qemu capabilities. qemu runs in probing mode (command line is
> "/home/kraxel/projects/qemu/build-default/x86_64-softmmu/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize" according to "systemctl status libvirtd -l"), apparently both qemu and libvirt wait for each other.
When libvirt is probing capabilities it passes a pipe file descriptor
for stderr. It reads from this pipe to detect any errors printed by
QEMU before daemonizing. When QEMU daemonizes, it closes this FD and
sets stderr to /dev/null. Libvirt knows qemu has successfully started
up at this point.
With this patch though, this code:
@@ -275,7 +276,10 @@ void os_setup_post(void)
dup2(fd, 0);
dup2(fd, 1);
- dup2(fd, 2);
+ /* In case -D is given do not redirect stderr to /dev/null */
+ if (!qemu_logfile) {
+ dup2(fd, 2);
+ }
close(fd);
means that QEMU will never close stderr anymore, so libvirt things
QEMU is still starting up....forever.
Given current libvirt behaviour / expectations, I think the only
option is to revert this change.
IMHO if applications want qemu logs to go to stderr, they should
explicitly ask for that to happen via a CLI arg.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2016-03-01 11:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 16:56 [Qemu-devel] [PATCH] os-posix: Log to logfile in case of daemonize Alex Pyrgiotis
2016-02-08 9:29 ` Paolo Bonzini
2016-02-11 12:12 ` Dimitris Aragiorgis
2016-02-11 12:31 ` Paolo Bonzini
2016-02-11 16:49 ` Dimitris Aragiorgis
2016-02-11 17:56 ` Paolo Bonzini
2016-02-18 11:38 ` [Qemu-devel] [PATCH] log: Redirect stderr to logfile if deamonized Dimitris Aragiorgis
2016-02-18 15:22 ` Paolo Bonzini
2016-02-18 17:12 ` Dimitris Aragiorgis
2016-02-19 17:25 ` Paolo Bonzini
2016-03-01 11:15 ` Gerd Hoffmann
2016-03-01 11:47 ` Daniel P. Berrange [this message]
2016-03-01 11:51 ` Paolo Bonzini
2016-03-01 11:58 ` Daniel P. Berrange
2016-03-01 12:03 ` Paolo Bonzini
2016-03-01 13:54 ` Daniel P. Berrange
2016-03-01 11:50 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160301114707.GG26728@redhat.com \
--to=berrange@redhat.com \
--cc=dimara@arrikto.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).