]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Close logfd when closing monitor
authorJiri Denemark <jdenemar@redhat.com>
Wed, 4 Nov 2015 11:45:15 +0000 (12:45 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 19 Nov 2015 08:41:23 +0000 (09:41 +0100)
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>
src/qemu/qemu_monitor.c
src/qemu/qemu_process.c

index f63c4eadea36d951c6f7a83bf5ecd854bfa45054..50c6549377b5cefb5447f76b53f3a61619f785d9 100644 (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);
index f12ebec0340cbbf50ead35fd6b8470998691d583..2192ad85ef3006891d884e6f51a7b1f1831f4764 100644 (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;
 }