提交 cfaebe83 编写于 作者: C Chris Venteicher 提交者: Jiri Denemark

qemu_process: Introduce qemuProcessQMPStart

This is a replacement for qemuProcessQMPRun to make the name consistent
with qemuProcessStart. The original qemuProcessQMPRun function is
renamed as qemuProcessQMPLaunch and becomes one of the simpler functions
called from the main qemuProcessQMPStart entry point. The following
patches will move parts of the code in qemuProcessQMPLaunch to the other
functions (qemuProcessQMPInit and qemuProcessQMPConnectMonitor).
Signed-off-by: NChris Venteicher <cventeic@redhat.com>
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 09d7daf3
......@@ -4385,7 +4385,7 @@ virQEMUCapsInitQMPSingle(virQEMUCapsPtr qemuCaps,
runUid, runGid, onlyTCG)))
goto cleanup;
if (qemuProcessQMPRun(proc) < 0)
if (qemuProcessQMPStart(proc) < 0)
goto cleanup;
if (onlyTCG)
......
......@@ -8391,8 +8391,21 @@ qemuProcessQMPNew(const char *binary,
}
int
qemuProcessQMPRun(qemuProcessQMPPtr proc)
static int
qemuProcessQMPInit(qemuProcessQMPPtr proc)
{
int ret = -1;
VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
ret = 0;
return ret;
}
static int
qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
{
virDomainXMLOptionPtr xmlopt = NULL;
const char *machine;
......@@ -8480,6 +8493,63 @@ qemuProcessQMPRun(qemuProcessQMPPtr proc)
}
static int
qemuProcessQMPConnectMonitor(qemuProcessQMPPtr proc)
{
int ret = -1;
VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld",
proc, proc->binary, (long long)proc->pid);
ret = 0;
return ret;
}
/**
* qemuProcessQMPStart:
* @proc: QEMU process and connection state created by qemuProcessQMPNew()
*
* Start and connect to QEMU binary so QMP queries can be made.
*
* Usage:
* proc = qemuProcessQMPNew(binary, libDir, runUid, runGid, forceTCG);
* qemuProcessQMPStart(proc);
* ** Send QMP Queries to QEMU using monitor (proc->mon) **
* qemuProcessQMPStop(proc);
* qemuProcessQMPFree(proc);
*
* Process error output (proc->stderr) remains available in qemuProcessQMP
* struct until qemuProcessQMPFree is called.
*/
int
qemuProcessQMPStart(qemuProcessQMPPtr proc)
{
int ret = -1;
VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
if (qemuProcessQMPInit(proc) < 0)
goto cleanup;
if (qemuProcessQMPLaunch(proc) < 0)
goto stop;
if (qemuProcessQMPConnectMonitor(proc) < 0)
goto stop;
ret = 0;
cleanup:
return ret;
stop:
qemuProcessQMPStop(proc);
goto cleanup;
}
void
qemuProcessQMPStop(qemuProcessQMPPtr proc)
{
......
......@@ -240,7 +240,7 @@ qemuProcessQMPPtr qemuProcessQMPNew(const char *binary,
void qemuProcessQMPFree(qemuProcessQMPPtr proc);
int qemuProcessQMPRun(qemuProcessQMPPtr proc);
int qemuProcessQMPStart(qemuProcessQMPPtr proc);
void qemuProcessQMPStop(qemuProcessQMPPtr proc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册