On 15.10.2015 17:49, Kashyap Chamarthy wrote:
On Thu, Oct 15, 2015 at 10:30:21AM +0300, Denis V. Lunev wrote:
The following is done:
- QMP/HMP events are now logged
I applied this patch series locally, and tried to test it the below way:
Launch a minimal QEMU instance:
$ /home/kashyapc/build/build-qemu-upstream/x86_64-softmmu/qemu-system-x86_64
\
-nographic \
-nodefconfig \
-nodefaults \
-m 2048 \
-cpu SandyBridge \
-device virtio-scsi-pci,id=scsi \
-device virtio-serial-pci \
-drive file=./cirros.qcow2,if=virtio,cache=writeback \
-serial stdio \
-D ./output-of-qemu.txt \
-qmp unix:./qmp-sock,server
And, issued QMP commands via `qmp-shell`:
$ ./qmp-shell /export/qmp-sock
Welcome to the QMP low-level shell!
Connected to QEMU 2.4.50
(QEMU)
(QEMU) query-status
{"return": {"status": "running", "singlestep": false, "running": true}}
(QEMU)
(QEMU) blockdev-snapshot-internal-sync device=virtio0 name=snapshot1
{"return": {}}
As we can see, the QMP commands gets successfully invoked, but nothing
gets logged to the output-of-qemu.txt file. Maybe because everything is
logged onto my stdout of qmp-shell?
A couple of related questions:
- Is the way I supplied '-D' option correct? If so, why the
output-of-qemu.txt file does not get created? _Should_ it?
- If I `touch output-of-qemu.txt`, then re-try issuing QMP commmands
from 'qmp-shell', still, nothing gets logged to it. Probably
because only stderr is supposed to get logged to '-D logfile'?
Do I have to turn on any other special knob to take advantage of
LOG_CMD/LOG_TIME flags mentioned in your patch[1]?
I'm pretty sure I'm missing something. . .
[1] http://lists.nongnu.org/archive/html/qemu-devel/2015-10/msg03316.html
- timestamp is added to the log message
- arguments of qemu_log/qemu_log_mask are not calculated now if the log
is disabled
These patches are sent in the hope that it is not too late for QEMU 2.5.
Logging subsystem in QEMU looks rudimentary to me and should be definitely
improved, f.e. log on stalled NFS could ruin the system completely. Anyway,
it is too late for this at the moment.
Signed-off-by: Denis V. Lunev <d...@openvz.org>
CC: Pavel Butsykin <pbutsy...@virtuozzo.com>
CC: Markus Armbruster <arm...@redhat.com>
CC: Luiz Capitulino <lcapitul...@redhat.com>
CC: Eric Blake <ebl...@redhat.com>
CC: Peter Maydell <peter.mayd...@linaro.org>
You forgot to specify the mask: -d cmd,time
qemu$ qemu-system-x86_64 -h|grep log
...
-d item1,... enable logging of specified items (use '-d help' for a
list of log items)
-D logfile output log to logfile (default stderr)
So it should work:
$
/home/kashyapc/build/build-qemu-upstream/x86_64-softmmu/qemu-system-x86_64 \
-nographic \
-nodefconfig \
-nodefaults \
-m 2048 \
-cpu SandyBridge \
-device virtio-scsi-pci,id=scsi \
-device virtio-serial-pci \
-drive file=./cirros.qcow2,if=virtio,cache=writeback \
-serial stdio \
-D ./output-of-qemu.txt \
-d cmd,time \
-qmp unix:./qmp-sock,server