On Sun, Dec 02, 2018 at 23:10:05 -0600, Chris Venteicher wrote: > qemuMonitor code lives in qemuProcessQmpConnectMonitor rather than in > qemuProcessQmpNew and qemuProcessQmpLaunch. > > This is consistent with existing structure in qemu_process.c where > qemuConnectMonitor function contains monitor code for domain process > activation. > > Simple code moves in this patch. Improvements in later patch. > > Only intended functional change in this patch is we don't > move (include) code to initiate process stop on failure to create monitor. > > As comments in qemuProcessQmpStart say... Client must always call > qemuProcessStop and qemuProcessQmpFree, even in error cases. > > Signed-off-by: Chris Venteicher <cventeic@xxxxxxxxxx> > --- > src/qemu/qemu_process.c | 50 ++++++++++++++++++++--------------------- > 1 file changed, 24 insertions(+), 26 deletions(-) > > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c > index 938d328235..a688be7f2c 100644 > --- a/src/qemu/qemu_process.c > +++ b/src/qemu/qemu_process.c > @@ -8163,10 +8163,6 @@ qemuProcessQmpNew(const char *binary, > > 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; > > error: > @@ -8198,7 +8194,6 @@ qemuProcessQmpInit(qemuProcessQmpPtr proc) > static int > qemuProcessQmpLaunch(qemuProcessQmpPtr proc) > { > - virDomainXMLOptionPtr xmlopt = NULL; > const char *machine; > int ret = -1; > > @@ -8250,6 +8245,28 @@ qemuProcessQmpLaunch(qemuProcessQmpPtr proc) > goto cleanup; > } > > + ret = 0; > + > + cleanup: > + return ret; > +} > + > + > +/* Connect Monitor to QEMU Process > + */ > +static int > +qemuProcessQmpConnectMonitor(qemuProcessQmpPtr proc) > +{ > + int ret = -1; > + virDomainXMLOptionPtr xmlopt = NULL; > + > + VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld", > + proc, NULLSTR(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; > @@ -8257,7 +8274,7 @@ qemuProcessQmpLaunch(qemuProcessQmpPtr proc) > proc->vm->pid = proc->pid; > > if (!(proc->mon = qemuMonitorOpen(proc->vm, &proc->config, true, true, > - 0, &callbacks, NULL))) > + 0, &callbacks, NULL))) > goto cleanup; > > virObjectLock(proc->mon); This hunk belongs to the patch which renamed cmd as proc. > @@ -8265,27 +8282,8 @@ qemuProcessQmpLaunch(qemuProcessQmpPtr proc) > ret = 0; > > cleanup: > - if (!proc->mon) > - qemuProcessQmpStop(proc); > + VIR_DEBUG("ret=%i", ret); > virObjectUnref(xmlopt); > - > - return ret; > -} > - > - > -/* Connect Monitor to QEMU Process > - */ > -static int > -qemuProcessQmpConnectMonitor(qemuProcessQmpPtr proc) > -{ > - int ret = -1; > - > - VIR_DEBUG("proc=%p, emulator=%s, proc->pid=%lld", > - proc, NULLSTR(proc->binary), (long long)proc->pid); > - > - ret = 0; > - > - VIR_DEBUG("ret=%i", ret); > return ret; > } Looks OK otherwise. Jirka -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list