Skip to contentSkip to conversation

vl: exit qemu on guest panic if -no-shutdown is not set

PATCH In review Christian Borntraeger 2 participants 2 messages Oct 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vl: exit qemu on guest panic if -no-shutdown is not set

For automated testing purposes it can be helpful to exit qemu (poweroff) when the guest panics. Make this the default unless -no-shutdown is specified.

For internal-errors like errors from KVM_RUN the behaviour is not changed, in other words QEMU does not exit to allow debugging in the QEMU monitor.

---
 qapi-schema.json | 4 ++--
 vl.c             | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
qapi-schema.json +2 -2
index ded1179..2b83ee4 100644
@@ -4488,10 +4488,10 @@
 #
 # @pause: system pauses
 #
-# Since: 2.1
+# Since: 2.1 (poweroff since 2.8)
 ##
 { 'enum': 'GuestPanicAction',
-  'data': [ 'pause' ] }
+  'data': [ 'pause', 'poweroff' ] }
 
 ##
 # @rtc-reset-reinjection
vl.c +5 -0
index c657acd..e1ef81f 100644
@@ -1783,6 +1783,11 @@ void qemu_system_guest_panicked(void)
     }
     qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);
     vm_stop(RUN_STATE_GUEST_PANICKED);
+    if (!no_shutdown) {
+        qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
+                                       &error_abort);
+        qemu_system_shutdown_request();
+    }
 }
 
 void qemu_system_reset_request(void)
Signature · 1 line
2.5.5
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Christian Borntraeger

For automated testing purposes it can be helpful to exit qemu (poweroff) when the guest panics. Make this the default unless -no-shutdown is specified.

For internal-errors like errors from KVM_RUN the behaviour is not changed, in other words QEMU does not exit to allow debugging in the QEMU monitor.

Quoted 5 lines
---
 qapi-schema.json | 4 ++--
 vl.c             | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

Shouldn't hurt libvirt, since that uses -no-shutdown.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org