[libvirt] Improve the reliability of pty path parsing
mbooth at redhat.com
Mon Nov 23 12:30:26 UTC 2009
The following are improve the reliability of libvirt's mapping of character
devices to pty paths.
When qemu starts up it will output one or more lines of the form:
char device redirected to /dev/pts/5
Note that the character device this refers to is not indicated, so the only way
to match this up is by knowing the order they're written in. This is not a
well-defined interface, and is therefore voodoo-magic.
The current code works against current versions of QEMU. However, when using the
-chardev syntax of newer QEMU, the output order changes (putting chardev first).
The first patch works by making all character devices use -chardev if it's
available. As well as being a better syntax, this makes the output of the
redirection lines again match the order they're specified on the command line.
The second patch uses this ordering to parse the ptys for channel devices from
the log output.
The third patch (almost) obsoletes the log output parsing method. If QEMU's
monitor supports 'info chardev', this gives structured information about
character devices, including pty mappings. The log output parsing method is
still required because QEMU may not support info chardev, and because the
monitor itself can be on a pty. The danger of the third patch is that it will
fix errors in the log output parsing code, which may then bitrot.
More information about the libvir-list