From nobody Thu Nov 6 01:29:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539004878221543.6812820339056; Mon, 8 Oct 2018 06:21:18 -0700 (PDT) Received: from localhost ([::1]:46227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9VTD-0000Wc-9e for importer@patchew.org; Mon, 08 Oct 2018 09:21:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9VRf-000863-0L for qemu-devel@nongnu.org; Mon, 08 Oct 2018 09:19:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9VRb-00032B-Kq for qemu-devel@nongnu.org; Mon, 08 Oct 2018 09:19:34 -0400 Received: from proxmox-new.maurer-it.com ([212.186.127.180]:44252) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9VRb-0002td-AU for qemu-devel@nongnu.org; Mon, 08 Oct 2018 09:19:31 -0400 Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 30EDD4244A; Mon, 8 Oct 2018 15:19:25 +0200 (CEST) From: Dominik Csapak To: qemu-devel@nongnu.org Date: Mon, 8 Oct 2018 15:19:24 +0200 Message-Id: <20181008131924.7377-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.186.127.180 Subject: [Qemu-devel] [PATCH] qapi: add info about reset to SHUTDOWN event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" when '-no-reboot' is set, it is interesting if the guest was originally shutdown or reset, so save and return that info Signed-off-by: Dominik Csapak --- qapi/run-state.json | 5 ++++- vl.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qapi/run-state.json b/qapi/run-state.json index 332e44897b..ec1769777d 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -107,6 +107,9 @@ # a guest-initiated ACPI shutdown request or other hardware-specific actio= n) # rather than a host request (such as sending qemu a SIGINT). (since 2.10) # +# @was_reset: If true, the shutdown was actually a reset, but no-reboot +# was set, so it got converted to a shutdown +# # Note: If the command-line option "-no-shutdown" has been specified, qemu= will # not exit, and a STOP event will eventually follow the SHUTDOWN event # @@ -118,7 +121,7 @@ # "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } # ## -{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool' } } +{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'was_reset': 'bool' } } =20 ## # @POWERDOWN: diff --git a/vl.c b/vl.c index 4e25c78bff..66e29cb830 100644 --- a/vl.c +++ b/vl.c @@ -1524,6 +1524,7 @@ void vm_state_notify(int running, RunState state) =20 static ShutdownCause reset_requested; static ShutdownCause shutdown_requested; +static bool shutdown_was_reset; static int shutdown_signal; static pid_t shutdown_pid; static int powerdown_requested; @@ -1681,6 +1682,7 @@ void qemu_system_guest_panicked(GuestPanicInformation= *info) void qemu_system_reset_request(ShutdownCause reason) { if (no_reboot && reason !=3D SHUTDOWN_CAUSE_SUBSYSTEM_RESET) { + shutdown_was_reset =3D true; shutdown_requested =3D reason; } else { reset_requested =3D reason; @@ -1807,7 +1809,8 @@ static bool main_loop_should_exit(void) request =3D qemu_shutdown_requested(); if (request) { qemu_kill_report(); - qapi_event_send_shutdown(shutdown_caused_by_guest(request)); + qapi_event_send_shutdown(shutdown_caused_by_guest(request), + shutdown_was_reset); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { --=20 2.11.0