]> xenbits.xensource.com Git - libvirt.git/commit
qemu_driver: Don't handle the EOF event if vm get restarted
authorGuoyi Tu <tugy@chinatelecom.cn>
Thu, 7 Dec 2023 12:52:39 +0000 (20:52 +0800)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 3 Jan 2024 17:13:23 +0000 (17:13 +0000)
commitdd2f36d66ecff58a309ee5629b9a263cb22f3016
tree0fd240a02f64e815359db97e033c34c621a241fc
parent392897d9b0f854ff1d56e1e2c5865936f094f27e
qemu_driver: Don't handle the EOF event if vm get restarted

Currently, libvirt creates a thread pool with only on thread to handle all
qemu monitor events for virtual machines, In the cases that if the thread
gets stuck while handling a monitor EOF event, such as unable to kill the
virtual machine process or release resources, the events of other virtual
machine will be also blocked, which will lead to the abnormal behavior of
other virtual machines.

For instance, when another virtual machine completes a shutdown operation
and the monitor EOF event has been queued but remains unprocessed, we
immediately destroy and start the virtual machine again, at a later time
when EOF event get processed, the processMonitorEOFEvent() will kill the
virtual machine that just started.

To address this issue, in the processMonitorEOFEvent(), we check whether
the current virtual machine's id is equal to the the one at the time
the event was generated. If they do not match, we immediately return.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Signed-off-by: dengpengcheng <dengpc12@chinatelecom.cn>
src/qemu/qemu_domain.c
src/qemu/qemu_driver.c
src/qemu/qemu_process.c