[libvirt] [PATCH v2] qemu: Ignore libvirt debug messages in qemu log

Eric Blake eblake at redhat.com
Thu Mar 31 15:06:43 UTC 2011


On 03/31/2011 02:40 AM, Jiri Denemark wrote:
> qemu driver uses a 4K buffer for reading qemu log file. This is enough
> when only qemu's output is present in the log file. However, when
> debugging messages are turned on, intermediate libvirt process fills the
> log with a bunch of debugging messages before it executes qemu binary.
> In such a case the buffer may become too small. However, we are not
> really interested in libvirt messages so they can be filtered out from
> the buffer.
> ---
> Notes:
>     Version 2:
>     - add a comment to virLogFormatString() that this new code relies on the log
>       message format
>     - temporarily replace '\n' with '\0' to provide a bound for strstr()

Looks nice, and your arguments about worrying about any further
optimizations being premature were valid.

ACK.

> +
> +        /* Filter out debug messages from intermediate libvirt process */
> +        while ((eol = strchr(filter_next, '\n'))) {
> +            *eol = '\0';
> +            if (strstr(filter_next, debug)) {
> +                memmove(filter_next, eol + 1, got - (eol - buf));
> +                got -= eol + 1 - filter_next;
> +            } else {
> +                filter_next = eol + 1;
> +                *eol = '\n';
> +            }
> +        }

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110331/a5f7aef1/attachment-0001.sig>


More information about the libvir-list mailing list