Skip to contentSkip to conversation

question: Does qemu-pr-helper have its own log files?

Qemu-devel Jie Wang 4 participants 6 messages Apr 23, 2019 – Apr 25, 2019

lore
Share & tools
lore

Jie Wang

author
#0 lore raw

 Does qemu-pr-helper have its own log files?

#1 lore raw
Quoted 1 line · Jie Wang

 Does qemu-pr-helper have its own log files?

When QEMU launches it, i think it just inherits stdout/err from QEMU itself, so errors appear mixed into QEMU's stdout output.

When libvirt launches it, there stdout is connected to /dev/null and stderr is connected to a pipe which libvirt closes almost immediately. This means any errors are lost as any attempt to write to stderr will get EPIPE :-(

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#3 lore raw
In reply to Jie Wang
Quoted 1 line · Jie Wang

 Does qemu-pr-helper have its own log files?

No, it does not. qemu-pr-helper uses stderr for errors and there is not much output during normal operation.

Check journalctl(1) for errors if you are launching it as a systemd service.

Stefan

#4 lore raw
Quoted 5 lines

From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 9:57 PM

Quoted 1 line · Jie Wang

 Does qemu-pr-helper have its own log files?

Quoted 7 lines

No, it does not. qemu-pr-helper uses stderr for errors and there is not much output during normal operation.

Check journalctl(1) for errors if you are launching it as a systemd service.

Stefan

The error messages that sent to *stderr* are *not* captured by anyone, then these error messages seems helpless.
It's different form qemu's log, qemu's stderr logs are transferred to virtlogd, that means these logs are finally written into disk.
Any further development plan?

We thought of:
1 logging into syslog, but the malicious guest may cause large amount of error
messages to overflow the message log.
2 or, let virtlogd to redirect its logs. But if virtlogd get restarted, the helper's log would
no longer be logged, because, unlike qemu, there's no qmp socket between libvirtd and the helper, the channel between the helper and virtlogd could not be re-established.
3 or, let qemu to log the helper's log, seems a little odd and complex.
4 or, let the helper realize its own logging scheme and log into itself's logfile ?

What's your suggestion? Thanks!

#2 lore raw
In reply to Daniel P. Berrangé
Quoted 5 lines · Daniel P. Berrangé
Quoted 1 line · Jie Wang

 Does qemu-pr-helper have its own log files?

When QEMU launches it, i think it just inherits stdout/err from QEMU itself, so errors appear mixed into QEMU's stdout output.

I thought QEMU does not launch qemu-pr-helper. Have I missed something?

QEMU ships systemd .service and .socket files for managing qemu-pr-helper externally.

Quoted 4 lines

When libvirt launches it, there stdout is connected to /dev/null and stderr is connected to a pipe which libvirt closes almost immediately. This means any errors are lost as any attempt to write to stderr will get EPIPE :-(

For anyone looking at the code:
src/qemu/qemu_process.c:qemuProcessStartManagedPRDaemon()

Stefan

#5 lore raw
In reply to Zhangbo (Oscar)
Quoted 8 lines · Zhangbo (Oscar)
Quoted 8 lines

From: Stefan Hajnoczi [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 9:57 PM

Quoted 1 line · Jie Wang

 Does qemu-pr-helper have its own log files?

No, it does not. qemu-pr-helper uses stderr for errors and there is not much output during normal operation.

Quoted 7 lines
Quoted 4 lines

Check journalctl(1) for errors if you are launching it as a systemd service.

Stefan

The error messages that sent to *stderr* are *not* captured by anyone, then these error messages seems helpless.

This depends on how qemu-pr-helper was launched.

Daniel Berrange mentioned that stderr is not captured when libvirt launches qemu-pr-helper. So in this case there is a problem.

Quoted 4 lines

It's different form qemu's log, qemu's stderr logs are transferred to virtlogd, that means these logs are finally written into disk.
Any further development plan?

Quoted 9 lines

We thought of:
1 logging into syslog, but the malicious guest may cause large amount of error
messages to overflow the message log.
2 or, let virtlogd to redirect its logs. But if virtlogd get restarted, the helper's log would
no longer be logged, because, unlike qemu, there's no qmp socket between libvirtd and the helper, the channel between the helper and virtlogd could not be re-established.
3 or, let qemu to log the helper's log, seems a little odd and complex.
4 or, let the helper realize its own logging scheme and log into itself's logfile ?

Perhaps libvirt should be modified to handle stderr.

Stefan