qemu/include/sysemu
Daniel P. Berrange d0d7708ba2 qemu-char: add logfile facility to all chardev backends
Typically a UNIX guest OS will log boot messages to a serial
port in addition to any graphical console. An admin user
may also wish to use the serial port for an interactive
console. A virtualization management system may wish to
collect system boot messages by logging the serial port,
but also wish to allow admins interactive access.

Currently providing such a feature forces the mgmt app
to either provide 2 separate serial ports, one for
logging boot messages and one for interactive console
login, or to proxy all output via a separate service
that can multiplex the two needs onto one serial port.
While both are valid approaches, they each have their
own downsides. The former causes confusion and extra
setup work for VM admins creating disk images. The latter
places an extra burden to re-implement much of the QEMU
chardev backends logic in libvirt or even higher level
mgmt apps and adds extra hops in the data transfer path.

A simpler approach that is satisfactory for many use
cases is to allow the QEMU chardev backends to have a
"logfile" property associated with them.

 $QEMU -chardev socket,host=localhost,port=9000,\
                server=on,nowait,id-charserial0,\
		logfile=/var/log/libvirt/qemu/test-serial0.log
       -device isa-serial,chardev=charserial0,id=serial0

This patch introduces a 'ChardevCommon' struct which
is setup as a base for all the ChardevBackend types.
Ideally this would be registered directly as a base
against ChardevBackend, rather than each type, but
the QAPI generator doesn't allow that since the
ChardevBackend is a non-discriminated union. The
ChardevCommon struct provides the optional 'logfile'
parameter, as well as 'logappend' which controls
whether QEMU truncates or appends (default truncate).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1452516281-27519-1-git-send-email-berrange@redhat.com>
[Call qemu_chr_parse_common if cd->parse is NULL. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15 18:58:02 +01:00
..
accel.h accel: Pass MachineState object to accel init functions 2014-10-09 12:57:10 +02:00
arch_init.h migration: move ram stuff to migration/ram 2015-06-12 06:40:59 +02:00
balloon.h Inhibit ballooning during postcopy 2015-11-10 15:00:28 +01:00
block-backend.h nbd-server: do not exit on failed memory allocation 2016-01-15 18:58:02 +01:00
blockdev.h qmp: Introduce blockdev-change-medium 2015-11-11 16:22:47 +01:00
bt.h sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
char.h qemu-char: add logfile facility to all chardev backends 2016-01-15 18:58:02 +01:00
cpus.h Revert "Introduce cpu_clean_all_dirty" 2015-11-05 11:28:23 +01:00
device_tree.h arm: Add PCIe host bridge in virt machine 2015-02-13 05:46:08 +00:00
dma.h exec.c: Make address_space_rw take transaction attributes 2015-04-26 16:49:24 +01:00
dump-arch.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
dump.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
hostmem.h hostmem: add properties for NUMA memory policy 2014-06-19 18:44:21 +03:00
iothread.h Remove various unused functions 2015-05-08 14:11:10 +03:00
kvm_int.h kvm-all: add support for multiple address spaces 2015-07-06 17:59:43 +02:00
kvm.h kvm: x86: add support for KVM_CAP_SPLIT_IRQCHIP 2015-12-17 17:33:47 +01:00
memory_mapping.h dump: rebase from host-private RAMBlock offsets to guest-physical addresses 2013-08-08 11:01:46 -04:00
numa.h numa: API to lookup NUMA node by address 2015-07-03 17:47:58 -03:00
os-posix.h os-posix: include sys/time.h 2014-06-23 11:01:24 -04:00
os-win32.h oslib-win32: Change return type of function getpagesize 2015-11-30 06:47:02 +01:00
qtest.h accel: Move qtest accel registration to qtest.c 2014-10-04 08:59:15 +02:00
replay.h replay: recording of the user input 2015-11-06 10:16:03 +01:00
rng-random.h sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
rng.h virtio_rng: replace custom backend API with UserCreatable.complete() callback 2014-01-28 12:47:11 -05:00
seccomp.h softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00
sysemu.h Finish non-postcopiable iterative devices before package 2015-11-12 17:52:29 +01:00
tpm_backend_int.h Remove various unused functions 2015-05-08 14:11:10 +03:00
tpm_backend.h Extend TPM TIS interface to support TPM 2 2015-05-31 20:29:02 +02:00
tpm.h TPM: fix build with tpm disabled 2015-06-03 18:19:15 +02:00
watchdog.h hw: move headers to include/ 2013-04-08 18:13:10 +02:00
xen-mapcache.h softmmu: move include files to include/sysemu/ 2012-12-19 08:32:45 +01:00