mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
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: Chris Venteicher <cventeic@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
09d7daf380
commit
cfaebe837c
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user