shutdown: Add source information to SHUTDOWN and RESET

Time to wire up all the call sites that request a shutdown or
reset to use the enum added in the previous patch.

It would have been less churn to keep the common case with no
arguments as meaning guest-triggered, and only modified the
host-triggered code paths, via a wrapper function, but then we'd
still have to audit that I didn't miss any host-triggered spots;
changing the signature forces us to double-check that I correctly
categorized all callers.

Since command line options can change whether a guest reset request
causes an actual reset vs. a shutdown, it's easy to also add the
information to reset requests.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts]
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part]
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts]
Message-Id: <20170515214114.15442-5-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Eric Blake 2017-05-15 16:41:13 -05:00 committed by Markus Armbruster
parent 802f045a5f
commit cf83f14005
60 changed files with 98 additions and 98 deletions

18
vl.c
View file

@ -1724,7 +1724,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
if (!no_shutdown) {
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
!!info, info, &error_abort);
qemu_system_shutdown_request();
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_PANIC);
}
if (info) {
@ -1741,13 +1741,12 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
}
}
void qemu_system_reset_request(void)
void qemu_system_reset_request(ShutdownCause reason)
{
if (no_reboot) {
/* TODO - add a parameter to allow callers to specify reason */
shutdown_requested = SHUTDOWN_CAUSE_HOST_ERROR;
shutdown_requested = reason;
} else {
reset_requested = SHUTDOWN_CAUSE_HOST_ERROR;
reset_requested = reason;
}
cpu_stop_current();
qemu_notify_event();
@ -1818,12 +1817,11 @@ void qemu_system_killed(int signal, pid_t pid)
qemu_notify_event();
}
void qemu_system_shutdown_request(void)
void qemu_system_shutdown_request(ShutdownCause reason)
{
trace_qemu_system_shutdown_request();
/* TODO - add a parameter to allow callers to specify reason */
replay_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
shutdown_requested = SHUTDOWN_CAUSE_HOST_ERROR;
trace_qemu_system_shutdown_request(reason);
replay_shutdown_request(reason);
shutdown_requested = reason;
qemu_notify_event();
}