From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyZDP-0008Nl-KI for qemu-devel@nongnu.org; Thu, 13 Apr 2017 03:30:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyZDM-0005aA-H2 for qemu-devel@nongnu.org; Thu, 13 Apr 2017 03:30:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44254) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyZDM-0005ZK-BC for qemu-devel@nongnu.org; Thu, 13 Apr 2017 03:30:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52C357D0DE for ; Thu, 13 Apr 2017 07:30:47 +0000 (UTC) From: Markus Armbruster References: <20170406210917.6896-1-eblake@redhat.com> Date: Thu, 13 Apr 2017 09:30:45 +0200 In-Reply-To: (Paolo Bonzini's message of "Thu, 13 Apr 2017 14:11:26 +0800") Message-ID: <87y3v4ojbu.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] event: Add signal information to SHUTDOWN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Eric Blake , qemu-devel@nongnu.org Paolo Bonzini 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 > > 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.