From: Jiri Denemark Date: Tue, 18 Jan 2011 11:07:13 +0000 (+0100) Subject: qemu: Avoid sending STOPPED event twice X-Git-Tag: v0.8.8~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15e786589373e7bd5b949be911b90e56481740fb;p=thirdparty%2Flibvirt.git qemu: Avoid sending STOPPED event twice In some circumstances, libvirtd would issue two STOPPED events after it stopped a domain. This was because an EOF event can arrive after a qemu process is killed but before qemuMonitorClose() is called. qemuHandleMonitorEOF() should ignore EOF when the domain is not running. I wasn't able to reproduce this bug directly, only after adding an artificial sleep() into qemudShutdownVMDaemon(). --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 22dc272aac..cff7a43111 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -356,6 +356,12 @@ qemuHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjLock(vm); + if (!virDomainObjIsActive(vm)) { + VIR_DEBUG("Domain %p is not active, ignoring EOF", vm); + virDomainObjUnlock(vm); + return; + } + priv = vm->privateData; if (!hasError && priv->monJSON && !priv->gotShutdown) { VIR_DEBUG("Monitor connection to '%s' closed without SHUTDOWN event; "