qemu: Close logfd when closing monitor

Remembering to call qemuMonitorSetDomainLog in the right paths before
calling qemuProcessStop is annoying and easy to forget. And I already
forgot to do so in commit v1.2.8-52-g0389060: logfd may be leaked if
QEMU process dies between Prepare and Finish migration phases.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2015-11-04 12:45:15 +01:00
parent 6e92b4438b
commit 2205d58b32
2 changed files with 2 additions and 2 deletions

View File

@ -960,6 +960,8 @@ qemuMonitorClose(qemuMonitorPtr mon)
PROBE(QEMU_MONITOR_CLOSE,
"mon=%p refs=%d", mon, mon->parent.parent.u.s.refs);
qemuMonitorSetDomainLog(mon, -1);
if (mon->fd >= 0) {
if (mon->watch) {
virEventRemoveHandle(mon->watch);

View File

@ -5065,8 +5065,6 @@ int qemuProcessStart(virConnectPtr conn,
/* We jump here if we failed to start the VM for any reason, or
* if we failed to initialize the now running VM. kill it off and
* pretend we never started it */
if (priv->mon)
qemuMonitorSetDomainLog(priv->mon, -1);
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stop_flags);
goto cleanup;
}