In common with regular QEMU guests, the QMP probing
will need an event loop for handling monitor I/O
operations.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_process.c | 16 ++++++++++++++++
src/qemu/qemu_process.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 73158e29e6..7475813e9f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8377,6 +8377,9 @@ qemuProcessQMPFree(qemuProcessQMPPtr proc)
return;
qemuProcessQMPStop(proc);
+
+ g_object_unref(proc->eventThread);
+
VIR_FREE(proc->binary);
VIR_FREE(proc->libDir);
VIR_FREE(proc->uniqDir);
@@ -8408,6 +8411,9 @@ qemuProcessQMPNew(const char *binary,
{
qemuProcessQMPPtr ret = NULL;
qemuProcessQMPPtr proc = NULL;
+ g_autoptr(GError) gerr = NULL;
+ const char *threadSuffix;
+ g_autofree char *threadName = NULL;
VIR_DEBUG("exec=%s, libDir=%s, runUid=%u, runGid=%u, forceTCG=%d",
binary, libDir, runUid, runGid, forceTCG);
@@ -8422,6 +8428,16 @@ qemuProcessQMPNew(const char *binary,
proc->runGid = runGid;
proc->forceTCG = forceTCG;
+ threadSuffix = strrchr(binary, '-');
+ if (threadSuffix)
+ threadSuffix++;
+ else
+ threadSuffix = binary;
+ threadName = g_strdup_printf("qmp-%s", threadSuffix);
+
+ if (!(proc->eventThread = virEventThreadNew(threadName)))
+ goto cleanup;
+
ret = g_steal_pointer(&proc);
cleanup:
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 9af9f967fd..3077d3ef9e 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -24,6 +24,7 @@
#include "qemu_conf.h"
#include "qemu_domain.h"
#include "virstoragefile.h"
+#include "vireventthread.h"
int qemuProcessPrepareMonitorChr(virDomainChrSourceDefPtr monConfig,
const char *domainDir);
@@ -217,6 +218,7 @@ struct _qemuProcessQMP {
char *monpath;
char *pidfile;
char *uniqDir;
+ virEventThread *eventThread;
virCommandPtr cmd;
qemuMonitorPtr mon;
pid_t pid;
--
2.24.1