Paolo Bonzini <pbonz...@redhat.com> writes: > On 07/04/2017 05:09, Eric Blake wrote: > >> qemu_kill_report() is already able to tell whether a shutdown >> was triggered by guest action (no output) or by a host signal >> (a message about termination is printed via error_report); but >> this information is then lost. Libvirt would like to be able >> to distinguish between a SHUTDOWN event triggered solely by >> guest request and one triggered by a SIGTERM on the host. >> >> Enhance the SHUTDOWN event to pass the value of shutdown_signal >> through to the monitor client, suitably remapped into a >> platform-neutral string. Note that mingw lacks decent signal >> support, and will never report a signal because it never calls >> qemu_system_killed(). >> >> See also https://bugzilla.redhat.com/1384007 >> >> Signed-off-by: Eric Blake <ebl...@redhat.com> > > I think this patch is fine for now; calling qemu_system_killed() from > os-win32.c is an orthogonal improvement.
Fair enough. However, I think the patch misses its stated goal even on POSIX hosts: to let libvirt distinguish host- and guest-initiated shutdown. Shutdown on signal is only one kind of host-initiated shutdown. All the others remain indistinguishable from guest-initiated shutdown. To reach the goal, we can track all host-initiated shutdowns, or all guest-initiated shutdowns. Pick the one that's easier to track. The former probably involves messing with OS-specific code, the latter probably doesn't.