All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: [PATCH 3/4] qmp: Allow setting -action parameters on the fly
Date: Tue,  8 Dec 2020 14:14:49 -0500	[thread overview]
Message-ID: <1607454890-3339-4-git-send-email-alejandro.j.jimenez@oracle.com> (raw)
In-Reply-To: <1607454890-3339-1-git-send-email-alejandro.j.jimenez@oracle.com>

Add QMP commands to allow for the behaviors specified by the
-action event=action command line option to be set at runtime,
mimicking the watchdog-set-action QMP command.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
---
 qapi/run-state.json       | 27 +++++++++++++++++++++++++++
 softmmu/runstate-action.c |  6 +++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/qapi/run-state.json b/qapi/run-state.json
index 27b62ce..de27516 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -451,6 +451,33 @@
 { 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
 
 ##
+# @reboot-set-action:
+#
+# Set reboot action
+#
+# Since: 6.0
+##
+{ 'command': 'reboot-set-action', 'data' : {'action': 'RebootAction'} }
+
+##
+# @shutdown-set-action:
+#
+# Set shutdown action
+#
+# Since: 6.0
+##
+{ 'command': 'shutdown-set-action', 'data' : {'action': 'ShutdownAction'} }
+
+##
+# @panic-set-action:
+#
+# Set panic action
+#
+# Since: 6.0
+##
+{ 'command': 'panic-set-action', 'data' : {'action': 'PanicAction'} }
+
+##
 # @GUEST_PANICKED:
 #
 # Emitted when guest OS panic is detected
diff --git a/softmmu/runstate-action.c b/softmmu/runstate-action.c
index 9c92595..aef23b8 100644
--- a/softmmu/runstate-action.c
+++ b/softmmu/runstate-action.c
@@ -29,7 +29,7 @@ static void runstate_action_help(void)
  * Set the internal state to react to a guest reboot event
  * as specified by the action parameter.
  */
-static void qmp_reboot_set_action(RebootAction act, Error **errp)
+void qmp_reboot_set_action(RebootAction act, Error **errp)
 {
     switch (act) {
     case REBOOT_ACTION_NONE:
@@ -47,7 +47,7 @@ static void qmp_reboot_set_action(RebootAction act, Error **errp)
  * Set the internal state to react to a guest shutdown event
  * as specified by the action parameter.
  */
-static void qmp_shutdown_set_action(ShutdownAction act, Error **errp)
+void qmp_shutdown_set_action(ShutdownAction act, Error **errp)
 {
     switch (act) {
     case SHUTDOWN_ACTION_PAUSE:
@@ -65,7 +65,7 @@ static void qmp_shutdown_set_action(ShutdownAction act, Error **errp)
  * Set the internal state to react to a guest panic event
  * as specified by the action parameter.
  */
-static void qmp_panic_set_action(PanicAction action, Error **errp)
+void qmp_panic_set_action(PanicAction action, Error **errp)
 {
     switch (action) {
     case PANIC_ACTION_NONE:
-- 
1.8.3.1



  parent reply	other threads:[~2020-12-08 19:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 19:14 [PATCH 0/4] Add a new -action parameter Alejandro Jimenez
2020-12-08 19:14 ` [PATCH 1/4] vl: Add an -action option to respond to guest events Alejandro Jimenez
2020-12-08 19:14 ` [PATCH 2/4] vl: Add option to avoid stopping VM upon guest panic Alejandro Jimenez
2020-12-08 19:14 ` Alejandro Jimenez [this message]
2020-12-08 19:57   ` [PATCH 3/4] qmp: Allow setting -action parameters on the fly Paolo Bonzini
2020-12-08 19:58     ` Paolo Bonzini
2020-12-08 20:59       ` Alejandro Jimenez
2020-12-08 19:14 ` [PATCH 4/4] qtest/pvpanic: Test panic option that allows VM to continue Alejandro Jimenez

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=1607454890-3339-4-git-send-email-alejandro.j.jimenez@oracle.com \
    --to=alejandro.j.jimenez@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.