From: Chen Hanxiao <chenhanxiao@xxxxxxxxx> We lacked of timestamp in tainting of guests log, which bring troubles for finding guest issues: such as whether a guest powerdown caused by qemu-monitor-command or others issues inside guests. If we had timestamp in tainting of guests log, it would be helpful when checking guest's logs(eg. /var/log/messages). Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx> --- src/qemu/qemu_domain.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 35baffb..21c90a9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4001,6 +4001,7 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, bool closeLog = false; if (virDomainObjTaint(obj, taint)) { + char *timestamp = NULL; char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(obj->def->uuid, uuidstr); @@ -4018,27 +4019,31 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, logCtxt = qemuDomainLogContextNew(driver, obj, QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH); if (!logCtxt) { - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } VIR_WARN("Unable to open domainlog"); - return; + goto cleanup; } closeLog = true; } + if ((timestamp = virTimeStringNow()) == NULL) + goto cleanup; + if (qemuDomainLogContextWrite(logCtxt, - "Domain id=%d is tainted: %s\n", + "%s: Domain id=%d is tainted: %s\n", + timestamp, obj->def->id, virDomainTaintTypeToString(taint)) < 0) virResetLastError(); + + cleanup: if (closeLog) qemuDomainLogContextFree(logCtxt); if (orig_err) { virSetError(orig_err); virFreeError(orig_err); } + + VIR_FREE(timestamp); } } -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list