qemu-patch-raspberry4/include/sysemu
Eric Blake 08fba7ac9b shutdown: Expose bool cause in SHUTDOWN and RESET events
Libvirt would like to be able to distinguish between a SHUTDOWN
event triggered solely by guest request and one triggered by a
SIGTERM or other action on the host.  While qemu_kill_report() was
already able to give different output to stderr based on whether a
shutdown was triggered by a host signal (but NOT by a host UI event,
such as clicking the X on the window), that information was then
lost to management.  The previous patches improved things to use an
enum throughout all callsites, so now we have something ready to
expose through QMP.

Note that for now, the decision was to expose ONLY a boolean,
rather than promoting ShutdownCause to a QAPI enum; this is because
libvirt has not expressed an interest in anything finer-grained.
We can still add additional details, in a backwards-compatible
manner, if a need later arises (if the addition happens before 2.10,
we can replace the bool with an enum; otherwise, the enum will have
to be in addition to the bool); this patch merely adds a helper
shutdown_caused_by_guest() to map the internal enum into the
external boolean.

Update expected iotest outputs to match the new data (complete
coverage of the affected tests is obtained by -raw, -qcow2, and -nbd).

Here is output from 'virsh qemu-monitor-event --loop' with the
patch installed:

event SHUTDOWN at 1492639680.731251 for domain fedora_13: {"guest":true}
event STOP at 1492639680.732116 for domain fedora_13: <null>
event SHUTDOWN at 1492639680.732830 for domain fedora_13: {"guest":false}

Note that libvirt runs qemu with -no-shutdown: the first SHUTDOWN event
was triggered by an action I took directly in the guest (shutdown -h),
at which point qemu stops the vcpus and waits for libvirt to do any
final cleanups; the second SHUTDOWN event is the result of libvirt
sending SIGTERM now that it has completed cleanup.  Libvirt is already
smart enough to only feed the first qemu SHUTDOWN event to the end user
(remember, virsh qemu-monitor-event is a low-level debugging interface
that is explicitly unsupported by libvirt, so it sees things that normal
end users do not); changing qemu to emit SHUTDOWN only once is outside
the scope of this series.

See also https://bugzilla.redhat.com/1384007

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20170515214114.15442-6-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-05-23 13:28:17 +02:00
..
accel.h accel: make configure_accelerator return void 2016-05-18 15:04:27 +03:00
arch_init.h nios2: Add support for Nios-II R1 2017-01-24 13:10:36 -08:00
balloon.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
block-backend.h block: Add errp to b{lk,drv}_truncate() 2017-04-28 16:02:02 +02:00
blockdev.h blockdev: Make orphaned -drive fatal 2017-02-21 13:17:45 +01:00
bt.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
char.h A large set of small patches. I have not included yet vhost-user-scsi, 2017-05-08 13:29:40 -04:00
cpus.h cpus: define QEMUTimerListNotifyCB for QEMU system emulation 2017-03-14 13:28:29 +01:00
cryptodev.h cryptodev: wrap the ready flag 2017-01-10 07:02:52 +02:00
device_tree.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
dma.h dma-helpers: explicitly pass alignment into DMA helpers 2016-10-27 16:29:13 -04:00
dump-arch.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
dump.h dump: Acquire BQL around vm_start() in dump thread 2017-05-05 12:10:00 +02:00
hax.h target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
hostmem.h hostmem: introduce host_memory_backend_mr_inited() 2017-04-20 15:22:41 -03:00
hw_accel.h Plumb the HAXM-based hardware acceleration support 2017-01-19 22:07:46 +01:00
iothread.h iothread: add poll-grow and poll-shrink parameters 2017-01-03 16:38:50 +00:00
kvm.h spapr: Add ibm,processor-radix-AP-encodings to the device tree 2017-04-26 12:00:41 +10:00
kvm_int.h kvm-all: add support for multiple address spaces 2015-07-06 17:59:43 +02:00
memory_mapping.h Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
numa.h numa: remove node_cpu bitmaps as they are no longer used 2017-05-11 16:08:50 -03:00
os-posix.h build: include sys/sysmacros.h for major() and minor() 2017-03-14 10:08:22 +00:00
os-win32.h log: Add locking to large logging blocks 2016-11-01 10:29:03 -06:00
qtest.h include: Clean up includes 2016-02-23 12:43:05 +00:00
replay.h shutdown: Preserve shutdown cause through replay 2017-05-23 13:28:17 +02:00
reset.h hw: move reset handlers from vl.c to hw/core 2017-01-16 17:52:35 +01:00
rng-random.h rng-random: rename RndRandom to RngRandom 2016-05-23 12:18:43 +05:30
rng.h rng: switch request queue to QSIMPLEQ 2016-03-08 12:54:14 +05:30
seccomp.h include: Clean up includes 2016-02-23 12:43:05 +00:00
sysemu.h shutdown: Expose bool cause in SHUTDOWN and RESET events 2017-05-23 13:28:17 +02:00
tpm.h TPM: fix build with tpm disabled 2015-06-03 18:19:15 +02:00
tpm_backend.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
tpm_backend_int.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
watchdog.h watchdog: introduction of get_watchdog_action 2016-01-27 15:34:47 +01:00
xen-mapcache.h xen/mapcache: store dma information in revmapcache entries for debugging 2017-05-16 11:49:09 -07:00