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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org