#include "qemu/osdep.h"
#include "audio/audio.h"
#include "block/block.h"
+#include "block/export.h"
#include "chardev/char.h"
#include "crypto/cipher.h"
#include "crypto/init.h"
{ RUN_STATE_RESTORE_VM, RUN_STATE_PRELAUNCH },
{ RUN_STATE_COLO, RUN_STATE_RUNNING },
+ { RUN_STATE_COLO, RUN_STATE_SHUTDOWN},
{ RUN_STATE_RUNNING, RUN_STATE_DEBUG },
{ RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR },
current_run_state = new_state;
}
-int runstate_is_running(void)
+bool runstate_is_running(void)
{
return runstate_check(RUN_STATE_RUNNING);
}
g_free(e);
}
-void vm_state_notify(int running, RunState state)
+void vm_state_notify(bool running, RunState state)
{
VMChangeStateEntry *e, *next;
}
/*
* TODO: Currently the available panic actions are: none, pause, and
- * poweroff, but in principle debug and reset could be supported as well.
+ * shutdown, but in principle debug and reset could be supported as well.
* Investigate any potential use cases for the unimplemented actions.
*/
- if (panic_action == PANIC_ACTION_PAUSE) {
+ if (panic_action == PANIC_ACTION_PAUSE
+ || (panic_action == PANIC_ACTION_SHUTDOWN && shutdown_action == SHUTDOWN_ACTION_PAUSE)) {
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
!!info, info);
vm_stop(RUN_STATE_GUEST_PANICKED);
- } else if (panic_action == PANIC_ACTION_POWEROFF) {
+ } else if (panic_action == PANIC_ACTION_SHUTDOWN) {
qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
!!info, info);
vm_stop(RUN_STATE_GUEST_PANICKED);
if (reboot_action == REBOOT_ACTION_SHUTDOWN &&
reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
shutdown_requested = reason;
+ } else if (!cpus_are_resettable()) {
+ error_report("cpus are not resettable, terminating");
+ shutdown_requested = reason;
} else {
reset_requested = reason;
}
void qemu_init_subsystems(void)
{
- Error *err;
+ Error *err = NULL;
os_set_line_buffering();
void qemu_cleanup(void)
{
- gdbserver_cleanup();
+ gdb_exit(0);
/*
* cleaning up the migration object cancels any existing migration
*/
migration_shutdown();
+ /*
+ * Close the exports before draining the block layer. The export
+ * drivers may have coroutines yielding on it, so we need to clean
+ * them up before the drain, as otherwise they may be get stuck in
+ * blk_wait_while_drained().
+ */
+ blk_exp_close_all();
+
/*
* We must cancel all block jobs while the block layer is drained,
* or cancelling will be affected by throttling and thus may block