summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlejandro Jimenez <alejandro.j.jimenez@oracle.com>2024-05-27 08:27:52 +0200
committerMichael S. Tsirkin <mst@redhat.com>2024-07-01 17:16:04 -0400
commit8db1f7be788b23f8eca189fe4546298ed387e9cb (patch)
treef6d33bad23cadad45c1fd2668f0c483f3ff241c0
parent6269086b0179e3d70750672174ed7fbd29ac7eaa (diff)
downloadfocaccia-qemu-8db1f7be788b23f8eca189fe4546298ed387e9cb.tar.gz
focaccia-qemu-8db1f7be788b23f8eca189fe4546298ed387e9cb.zip
pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal
Emit a QMP event on receiving a PVPANIC_SHUTDOWN event. Even though a typical
SHUTDOWN event will be sent, it will be indistinguishable from a shutdown
originating from other cases (e.g. KVM exit due to KVM_SYSTEM_EVENT_SHUTDOWN)
that also issue the guest-shutdown cause.
A management layer application can detect the new GUEST_PVSHUTDOWN event to
determine if the guest is using the pvpanic interface to request shutdowns.

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Message-Id: <20240527-pvpanic-shutdown-v8-6-5a28ec02558b@t-8ch.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--qapi/run-state.json14
-rw-r--r--system/runstate.c1
2 files changed, 15 insertions, 0 deletions
diff --git a/qapi/run-state.json b/qapi/run-state.json
index f8773f23b2..5ac0fec852 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -463,6 +463,20 @@
   'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
 
 ##
+# @GUEST_PVSHUTDOWN:
+#
+# Emitted when guest submits a shutdown request via pvpanic interface
+#
+# Since: 9.1
+#
+# Example:
+#
+#     <- { "event": "GUEST_PVSHUTDOWN",
+#          "timestamp": { "seconds": 1648245259, "microseconds": 893771 } }
+##
+{ 'event': 'GUEST_PVSHUTDOWN' }
+
+##
 # @GuestPanicAction:
 #
 # An enumeration of the actions taken when guest OS panic is detected
diff --git a/system/runstate.c b/system/runstate.c
index fc49fd3e61..c833316f6d 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -586,6 +586,7 @@ void qemu_system_guest_crashloaded(GuestPanicInformation *info)
 
 void qemu_system_guest_pvshutdown(void)
 {
+    qapi_event_send_guest_pvshutdown();
     qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
 }