summaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-05-15 16:41:11 -0500
committerMarkus Armbruster <armbru@redhat.com>2017-05-23 13:28:17 +0200
commitaedbe19297907143f17b733a7ff0e0534377bed1 (patch)
tree17fca30e27436c3f9dee212d1fa1b37434db588f /hw/i386
parent7af88279e4972dd6bf735b620876d54b7a355c4d (diff)
downloadqemu-aedbe19297907143f17b733a7ff0e0534377bed1.zip
shutdown: Prepare for use of an enum in reset/shutdown_request
We want to track why a guest was shutdown; in particular, being able to tell the difference between a guest request (such as ACPI request) and host request (such as SIGINT) will prove useful to libvirt. Since all requests eventually end up changing shutdown_requested in vl.c, the logical change is to make that value track the reason, rather than its current 0/1 contents. Since command-line options control whether a reset request is turned into a shutdown request instead, the same treatment is given to reset_requested. This patch adds an internal enum ShutdownCause that describes reasons that a shutdown can be requested, and changes qemu_system_reset() to pass the reason through, although for now nothing is actually changed with regards to what gets reported. The enum could be exported via QAPI at a later date, if deemed necessary, but for now, there has not been a request to expose that much detail to end clients. For the most part, we turn 0 into SHUTDOWN_CAUSE_NONE, and 1 into SHUTDOWN_CAUSE_HOST_ERROR; the only specific case where we have enough information right now to use a different value is when we are reacting to a host signal. It will take a further patch to edit all call-sites that can trigger a reset or shutdown request to properly pass in any other reasons; this patch includes TODOs to point such places out. qemu_system_reset() trades its 'bool report' parameter for a 'ShutdownCause reason', with all non-zero values having the same effect; this lets us get rid of the weird #defines for VMRESET_* as synonyms for bools. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <20170515214114.15442-3-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/xen/xen-hvm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index b1c05ffb86..222d89a3b9 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -1089,11 +1089,14 @@ static void cpu_handle_ioreq(void *opaque)
* causes Xen to powerdown the domain.
*/
if (runstate_is_running()) {
+ ShutdownCause request;
+
if (qemu_shutdown_requested_get()) {
destroy_hvm_domain(false);
}
- if (qemu_reset_requested_get()) {
- qemu_system_reset(VMRESET_REPORT);
+ request = qemu_reset_requested_get();
+ if (request) {
+ qemu_system_reset(request);
destroy_hvm_domain(true);
}
}