pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal
authorAlejandro Jimenez <alejandro.j.jimenez@oracle.com>
Mon, 27 May 2024 06:27:52 +0000 (08:27 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 1 Jul 2024 21:16:04 +0000 (17:16 -0400)
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>
qapi/run-state.json
system/runstate.c

index f8773f23b298db22bebab16fd48dcf0242fe2f76..5ac0fec85236fbc1fca2e00ca2abee5a38d2b3b2 100644 (file)
 { 'event': 'GUEST_CRASHLOADED',
   '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:
 #
index fc49fd3e6106ee255b2fdcd9503ecd23f7177cff..c833316f6deffd3d1ba95d69566ef4cd028a56be 100644 (file)
@@ -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);
 }