提交 92890fbf 编写于 作者: D Daniel P. Berrangé

qemu: start/stop an event thread for QMP probing

In common with regular QEMU guests, the QMP probing
will need an event loop for handling monitor I/O
operations.
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 e6afacb0
......@@ -8373,6 +8373,9 @@ qemuProcessQMPFree(qemuProcessQMPPtr proc)
return;
qemuProcessQMPStop(proc);
g_object_unref(proc->eventThread);
VIR_FREE(proc->binary);
VIR_FREE(proc->libDir);
VIR_FREE(proc->uniqDir);
......@@ -8404,6 +8407,8 @@ qemuProcessQMPNew(const char *binary,
{
qemuProcessQMPPtr ret = NULL;
qemuProcessQMPPtr proc = 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);
......@@ -8418,6 +8423,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:
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册