qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] vl: exit qemu on guest panic if -no-shutdown is not set
@ 2016-10-18  7:29 Christian Borntraeger
  2016-10-18 13:26 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Borntraeger @ 2016-10-18  7:29 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: qemu-devel, Eric Blake, Markus Armbruster, 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.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 qapi-schema.json | 4 ++--
 vl.c             | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index ded1179..2b83ee4 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -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
diff --git a/vl.c b/vl.c
index c657acd..e1ef81f 100644
--- a/vl.c
+++ b/vl.c
@@ -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)
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v2] vl: exit qemu on guest panic if -no-shutdown is not set
  2016-10-18  7:29 [Qemu-devel] [PATCH v2] vl: exit qemu on guest panic if -no-shutdown is not set Christian Borntraeger
@ 2016-10-18 13:26 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2016-10-18 13:26 UTC (permalink / raw)
  To: Christian Borntraeger, Paolo Bonzini; +Cc: qemu-devel, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

On 10/18/2016 02:29 AM, Christian Borntraeger wrote:
> 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.
> 
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  qapi-schema.json | 4 ++--
>  vl.c             | 5 +++++
>  2 files changed, 7 insertions(+), 2 deletions(-)

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

Reviewed-by: Eric Blake <eblake@redhat.com>

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-18 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18  7:29 [Qemu-devel] [PATCH v2] vl: exit qemu on guest panic if -no-shutdown is not set Christian Borntraeger
2016-10-18 13:26 ` Eric Blake

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).