VIR_LOG_INIT("qemu.qemu_process");
-#define ATTACH_POSTFIX ": attaching\n"
-#define SHUTDOWN_POSTFIX ": shutting down\n"
-
/**
* qemuProcessRemoveDomainStatus
*
size_t i;
char *timestamp;
char *tmppath = NULL;
- char ebuf[1024];
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainLogContextPtr logCtxt = NULL;
if ((logCtxt = qemuDomainLogContextNew(driver, vm,
QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP))) {
- int logfile = qemuDomainLogContextGetWriteFD(logCtxt);
if ((timestamp = virTimeStringNow()) != NULL) {
- if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
- safewrite(logfile, SHUTDOWN_POSTFIX,
- strlen(SHUTDOWN_POSTFIX)) < 0) {
- VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof(ebuf)));
- }
-
+ qemuDomainLogContextWrite(logCtxt, "%s: shutting down\n", timestamp);
VIR_FREE(timestamp);
}
qemuDomainLogContextFree(logCtxt);
bool monJSON)
{
size_t i;
- char ebuf[1024];
- int logfile = -1;
qemuDomainLogContextPtr logCtxt = NULL;
char *timestamp;
qemuDomainObjPrivatePtr priv = vm->privateData;
if (!(logCtxt = qemuDomainLogContextNew(driver, vm,
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH)))
goto error;
- logfile = qemuDomainLogContextGetWriteFD(logCtxt);
VIR_DEBUG("Determining emulator version");
virObjectUnref(priv->qemuCaps);
if ((timestamp = virTimeStringNow()) == NULL)
goto error;
- if (safewrite(logfile, timestamp, strlen(timestamp)) < 0 ||
- safewrite(logfile, ATTACH_POSTFIX, strlen(ATTACH_POSTFIX)) < 0) {
- VIR_WARN("Unable to write timestamp to logfile: %s",
- virStrerror(errno, ebuf, sizeof(ebuf)));
- }
+ qemuDomainLogContextWrite(logCtxt, "%s: attaching\n", timestamp);
VIR_FREE(timestamp);
qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH, logCtxt);