---
src/logging/log_handler.c | 1 +
src/qemu/qemu_process.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c
index 87748d9..cfadc69 100644
--- a/src/logging/log_handler.c
+++ b/src/logging/log_handler.c
@@ -160,6 +160,7 @@ virLogHandlerDomainLogFileEvent(int watch,
}
reread:
+ g_usleep(200 * 1000);
len = read(fd, buf, sizeof(buf));
if (len < 0) {
if (errno == EINTR)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f21b8f1..22219f8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -93,6 +93,8 @@
#include "viridentity.h"
#include "virthreadjob.h"
#include "virutil.h"
+#include "logging/log_manager.h"
+#include "logging/log_protocol.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
@@ -6829,6 +6831,39 @@ qemuProcessLaunch(virConnectPtr conn,
incoming != NULL) < 0)
goto cleanup;
+ if (qemuDomainLogContextGetManager(logCtxt)) {
+ int fd = -1;
+ char *buf;
+ int rc;
+ ino_t inode;
+ off_t offset;
+
+ if ((fd = virLogManagerDomainOpenLogFile(
+ qemuDomainLogContextGetManager(logCtxt),
+ "qemu",
+ vm->def->uuid,
+ vm->def->name,
+ "/tmp/virtlogd-test",
+ VIR_LOG_MANAGER_PROTOCOL_DOMAIN_OPEN_LOG_FILE_TRUNCATE,
+ NULL, NULL)) < 0)
+ goto cleanup;
+
+ buf = g_new0(char, 10000);
+ rc = safewrite(fd, buf, 10000);
+ VIR_FORCE_CLOSE(fd);
+
+ if (rc < 10000) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "can't write all bytes to test file");
+ goto cleanup;
+ }
+
+ if (virLogManagerDomainGetLogFilePosition(
+ qemuDomainLogContextGetManager(logCtxt),
+ "/tmp/virtlogd-test", 0, &inode, &offset) <
0)
+ goto cleanup;
+ }
+
VIR_DEBUG("Building emulator command line");
if (!(cmd = qemuBuildCommandLine(driver,
qemuDomainLogContextGetManager(logCtxt),
--
1.8.3.1