qemu-e2k/backends
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
..
baum.c qemu-char: add logfile facility to all chardev backends 2016-01-15 18:58:02 +01:00
hostmem-file.c maint: avoid useless "if (foo) free(foo)" pattern 2015-09-11 10:21:38 +03:00
hostmem-ram.c hostmem-ram: don't exit qemu if size of memory-backend-ram is way too big 2014-09-09 13:41:44 +02:00
hostmem.c hostmem: Ignore ENOSYS while setting MPOL_DEFAULT 2015-11-23 10:43:38 -02:00
Makefile.objs backends: Introduce chr-testdev 2014-08-06 17:53:05 +02:00
msmouse.c qemu-char: add logfile facility to all chardev backends 2016-01-15 18:58:02 +01:00
rng-egd.c qerror: Clean up QERR_ macros to expand into a single string 2015-06-22 18:20:40 +02:00
rng-random.c qerror: Clean up QERR_ macros to expand into a single string 2015-06-22 18:20:40 +02:00
rng.c qerror: Clean up QERR_ macros to expand into a single string 2015-06-22 18:20:40 +02:00
testdev.c qemu-char: convert testdev backend to data-driven creation 2015-10-19 10:06:09 +02:00
tpm.c qerror: Clean up QERR_ macros to expand into a single string 2015-06-22 18:20:40 +02:00