qemu: process: Append the "shutting down" message using the new APIs

Use qemuDomainLogAppendMessage rather than attempting to open a new
logging context with file descriptors. The new approach allows to log
the message even if qemu is still running at that point which appens
during migration finish phase where qemuProcessStop is killing qemu.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1312188
This commit is contained in:
Peter Krempa 2016-06-07 16:31:15 +02:00
parent 91a6eacc8f
commit cf3ea0769c

View File

@ -5605,7 +5605,6 @@ void qemuProcessStop(virQEMUDriverPtr driver,
size_t i; size_t i;
char *timestamp; char *timestamp;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainLogContextPtr logCtxt = NULL;
VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%llu, " VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%llu, "
"reason=%s, asyncJob=%s, flags=%x", "reason=%s, asyncJob=%s, flags=%x",
@ -5642,13 +5641,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
/* Wake up anything waiting on domain condition */ /* Wake up anything waiting on domain condition */
virDomainObjBroadcast(vm); virDomainObjBroadcast(vm);
if ((logCtxt = qemuDomainLogContextNew(driver, vm, if ((timestamp = virTimeStringNow()) != NULL) {
QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP))) { qemuDomainLogAppendMessage(driver, vm, "%s: shutting down\n", timestamp);
if ((timestamp = virTimeStringNow()) != NULL) { VIR_FREE(timestamp);
qemuDomainLogContextWrite(logCtxt, "%s: shutting down\n", timestamp);
VIR_FREE(timestamp);
}
qemuDomainLogContextFree(logCtxt);
} }
/* Clear network bandwidth */ /* Clear network bandwidth */