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

qemu_process: Move monitor code to qemuProcessQMPConnectMonitor

All code related to QEMU monitor is moved from qemuProcessQMPNew and
qemuProcessQMPInit into 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>
上级 cfaebe83
...@@ -8379,10 +8379,6 @@ qemuProcessQMPNew(const char *binary, ...@@ -8379,10 +8379,6 @@ qemuProcessQMPNew(const char *binary,
virPidFileForceCleanupPath(proc->pidfile); virPidFileForceCleanupPath(proc->pidfile);
proc->config.type = VIR_DOMAIN_CHR_TYPE_UNIX;
proc->config.data.nix.path = proc->monpath;
proc->config.data.nix.listen = false;
return proc; return proc;
error: error:
...@@ -8407,7 +8403,6 @@ qemuProcessQMPInit(qemuProcessQMPPtr proc) ...@@ -8407,7 +8403,6 @@ qemuProcessQMPInit(qemuProcessQMPPtr proc)
static int static int
qemuProcessQMPLaunch(qemuProcessQMPPtr proc) qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
{ {
virDomainXMLOptionPtr xmlopt = NULL;
const char *machine; const char *machine;
int status = 0; int status = 0;
int ret = -1; int ret = -1;
...@@ -8470,25 +8465,9 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc) ...@@ -8470,25 +8465,9 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
goto cleanup; goto cleanup;
} }
if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) ||
!(proc->vm = virDomainObjNew(xmlopt)))
goto cleanup;
proc->vm->pid = proc->pid;
if (!(proc->mon = qemuMonitorOpen(proc->vm, &proc->config, true, true,
0, &callbacks, NULL)))
goto cleanup;
virObjectLock(proc->mon);
ret = 0; ret = 0;
cleanup: cleanup:
if (!proc->mon)
qemuProcessQMPStop(proc);
virObjectUnref(xmlopt);
return ret; return ret;
} }
...@@ -8496,13 +8475,32 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc) ...@@ -8496,13 +8475,32 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
static int static int
qemuProcessQMPConnectMonitor(qemuProcessQMPPtr proc) qemuProcessQMPConnectMonitor(qemuProcessQMPPtr proc)
{ {
virDomainXMLOptionPtr xmlopt = NULL;
int ret = -1; int ret = -1;
VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld", VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld",
proc, proc->binary, (long long)proc->pid); proc, proc->binary, (long long)proc->pid);
proc->config.type = VIR_DOMAIN_CHR_TYPE_UNIX;
proc->config.data.nix.path = proc->monpath;
proc->config.data.nix.listen = false;
if (!(xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) ||
!(proc->vm = virDomainObjNew(xmlopt)))
goto cleanup;
proc->vm->pid = proc->pid;
if (!(proc->mon = qemuMonitorOpen(proc->vm, &proc->config, true, true,
0, &callbacks, NULL)))
goto cleanup;
virObjectLock(proc->mon);
ret = 0; ret = 0;
cleanup:
virObjectUnref(xmlopt);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册