|
@@ -482,7 +482,8 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
|
|
|
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
|
|
|
!!info, info);
|
|
|
vm_stop(RUN_STATE_GUEST_PANICKED);
|
|
|
- } else if (panic_action == PANIC_ACTION_SHUTDOWN) {
|
|
|
+ } else if (panic_action == PANIC_ACTION_SHUTDOWN ||
|
|
|
+ panic_action == PANIC_ACTION_EXIT_FAILURE) {
|
|
|
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
|
|
|
!!info, info);
|
|
|
vm_stop(RUN_STATE_GUEST_PANICKED);
|
|
@@ -662,7 +663,7 @@ void qemu_system_debug_request(void)
|
|
|
qemu_notify_event();
|
|
|
}
|
|
|
|
|
|
-static bool main_loop_should_exit(void)
|
|
|
+static bool main_loop_should_exit(int *status)
|
|
|
{
|
|
|
RunState r;
|
|
|
ShutdownCause request;
|
|
@@ -680,6 +681,10 @@ static bool main_loop_should_exit(void)
|
|
|
if (shutdown_action == SHUTDOWN_ACTION_PAUSE) {
|
|
|
vm_stop(RUN_STATE_SHUTDOWN);
|
|
|
} else {
|
|
|
+ if (request == SHUTDOWN_CAUSE_GUEST_PANIC &&
|
|
|
+ panic_action == PANIC_ACTION_EXIT_FAILURE) {
|
|
|
+ *status = EXIT_FAILURE;
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -715,12 +720,14 @@ static bool main_loop_should_exit(void)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-void qemu_main_loop(void)
|
|
|
+int qemu_main_loop(void)
|
|
|
{
|
|
|
+ int status = EXIT_SUCCESS;
|
|
|
#ifdef CONFIG_PROFILER
|
|
|
int64_t ti;
|
|
|
#endif
|
|
|
- while (!main_loop_should_exit()) {
|
|
|
+
|
|
|
+ while (!main_loop_should_exit(&status)) {
|
|
|
#ifdef CONFIG_PROFILER
|
|
|
ti = profile_getclock();
|
|
|
#endif
|
|
@@ -729,6 +736,8 @@ void qemu_main_loop(void)
|
|
|
dev_time += profile_getclock() - ti;
|
|
|
#endif
|
|
|
}
|
|
|
+
|
|
|
+ return status;
|
|
|
}
|
|
|
|
|
|
void qemu_add_exit_notifier(Notifier *notify)
|