qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com,
	berrange@redhat.com
Subject: [Qemu-devel] [PATCH] qapi: add info about reset to SHUTDOWN event
Date: Mon,  8 Oct 2018 15:19:24 +0200	[thread overview]
Message-ID: <20181008131924.7377-1-d.csapak@proxmox.com> (raw)

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 <d.csapak@proxmox.com>
---
 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 action)
 # 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' } }
 
 ##
 # @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)
 
 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 != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
+        shutdown_was_reset = true;
         shutdown_requested = reason;
     } else {
         reset_requested = reason;
@@ -1807,7 +1809,8 @@ static bool main_loop_should_exit(void)
     request = 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 {
-- 
2.11.0

             reply	other threads:[~2018-10-08 13:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 13:19 Dominik Csapak [this message]
2018-10-17  7:17 ` [Qemu-devel] [PATCH] qapi: add info about reset to SHUTDOWN event Dominik Csapak
2018-10-17 10:58   ` Paolo Bonzini
2018-10-17 11:34     ` Dominik Csapak
2018-10-17 11:36       ` Paolo Bonzini
2018-10-17 13:54     ` Eric Blake
2018-10-17 14:43       ` Paolo Bonzini
2018-10-23  7:51         ` Dominik Csapak
2018-10-17 13:51   ` Eric Blake
2018-10-17 14:02     ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181008131924.7377-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).