mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
virLXCProcessReadLogOutputData: Refill buffer after filtering out noise
The caller passes in a 1k buffer, which when debug logging is in use is easily filled with debug messages only. Thus after the first pass which is common if the controller process already terminated the buffer will not contain the real error, but rather a truncated debug message, which will result in an error such as: error: internal error: guest failed to start: 2023-08-01 12:58:31.948+0000: 798195: i instead of the proper error: error: internal error: guest failed to start: Failure in libvirt_lxc startup: Failed to create /home/rootfs/.oldroot: Permission denied To fix the above retry the reading loop if the filtering function made space in the buffer. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
4b57c5fecf
commit
1f8558cf9a
@ -1011,6 +1011,7 @@ virLXCProcessReadLogOutputData(virDomainObj *vm,
|
||||
int retries = 10;
|
||||
int got = 0;
|
||||
char *filter_next = buf;
|
||||
bool filtered;
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
@ -1036,11 +1037,13 @@ virLXCProcessReadLogOutputData(virDomainObj *vm,
|
||||
buf[got] = '\0';
|
||||
|
||||
/* Filter out debug messages from intermediate libvirt process */
|
||||
filtered = false;
|
||||
while ((eol = strchr(filter_next, '\n'))) {
|
||||
*eol = '\0';
|
||||
if (virLXCProcessIgnorableLogLine(filter_next)) {
|
||||
memmove(filter_next, eol + 1, got - (eol - buf));
|
||||
got -= eol + 1 - filter_next;
|
||||
filtered = true;
|
||||
} else {
|
||||
filter_next = eol + 1;
|
||||
*eol = '\n';
|
||||
@ -1054,6 +1057,9 @@ virLXCProcessReadLogOutputData(virDomainObj *vm,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (filtered)
|
||||
continue;
|
||||
|
||||
if (isdead)
|
||||
return got;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user