Revision ede085b3

b/include/sysemu/sysemu.h
22 22
bool runstate_check(RunState state);
23 23
void runstate_set(RunState new_state);
24 24
int runstate_is_running(void);
25
bool runstate_needs_reset(void);
25 26
typedef struct vm_change_state_entry VMChangeStateEntry;
26 27
typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
27 28

  
b/qapi-schema.json
174 174
# @suspended: guest is suspended (ACPI S3)
175 175
#
176 176
# @watchdog: the watchdog action is configured to pause and has been triggered
177
#
178
# @guest-panicked: guest has been panicked as a result of guest OS panic
177 179
##
178 180
{ 'enum': 'RunState',
179 181
  'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused',
180 182
            'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm',
181
            'running', 'save-vm', 'shutdown', 'suspended', 'watchdog' ] }
183
            'running', 'save-vm', 'shutdown', 'suspended', 'watchdog',
184
            'guest-panicked' ] }
182 185

  
183 186
##
184 187
# @SnapshotInfo
b/qmp.c
149 149
{
150 150
    Error *local_err = NULL;
151 151

  
152
    if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
153
               runstate_check(RUN_STATE_SHUTDOWN)) {
152
    if (runstate_needs_reset()) {
154 153
        error_set(errp, QERR_RESET_REQUIRED);
155 154
        return;
156 155
    } else if (runstate_check(RUN_STATE_SUSPENDED)) {
b/vl.c
594 594
    { RUN_STATE_RUNNING, RUN_STATE_SAVE_VM },
595 595
    { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN },
596 596
    { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG },
597
    { RUN_STATE_RUNNING, RUN_STATE_GUEST_PANICKED },
597 598

  
598 599
    { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING },
599 600

  
......
608 609
    { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING },
609 610
    { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE },
610 611

  
612
    { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED },
613

  
611 614
    { RUN_STATE_MAX, RUN_STATE_MAX },
612 615
};
613 616

  
......
649 652
    return runstate_check(RUN_STATE_RUNNING);
650 653
}
651 654

  
655
bool runstate_needs_reset(void)
656
{
657
    return runstate_check(RUN_STATE_INTERNAL_ERROR) ||
658
        runstate_check(RUN_STATE_SHUTDOWN) ||
659
        runstate_check(RUN_STATE_GUEST_PANICKED);
660
}
661

  
652 662
StatusInfo *qmp_query_status(Error **errp)
653 663
{
654 664
    StatusInfo *info = g_malloc0(sizeof(*info));
......
1984 1994
        cpu_synchronize_all_states();
1985 1995
        qemu_system_reset(VMRESET_REPORT);
1986 1996
        resume_all_vcpus();
1987
        if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
1988
            runstate_check(RUN_STATE_SHUTDOWN)) {
1997
        if (runstate_needs_reset()) {
1989 1998
            runstate_set(RUN_STATE_PAUSED);
1990 1999
        }
1991 2000
    }

Also available in: Unified diff