]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: Fix domain shutdown
authorJim Fehlig <jfehlig@suse.com>
Fri, 19 Feb 2021 23:29:10 +0000 (16:29 -0700)
committerJim Fehlig <jfehlig@suse.com>
Mon, 22 Feb 2021 17:47:11 +0000 (10:47 -0700)
commit87a9d3a6b01baebdca33d95ad0e79781b6a46ca8
tree13eaf0ab064ecc051ef8c4826c47a6b889934863
parentbf5ec3bb220599f97e4321b4d520d9f4761b42e3
libxl: Fix domain shutdown

Commit fa30ee04a2 caused a regression in normal domain shutown.
Initiating a shutdown from within the domain or via 'virsh shutdown'
does cause the guest OS running in the domain to shutdown, but libvirt
never reaps the domain so it is always shown in a running state until
calling 'virsh destroy'.

The shutdown thread is also an internal user of the driver shutdown
machinery and eventually calls libxlDomainDestroyInternal where
the ignoreDeathEvent inhibitor is set, but running in a thread
introduces the possibility of racing with the death event from
libxl. This can be prevented by setting ignoreDeathEvent before
running the shutdown thread.

An additional improvement is to handle the destroy event synchronously
instead of spawning a thread. The time consuming aspects of destroying
a domain have been completed when the destroy event is delivered.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/libxl/libxl_domain.c