Bug 1269575

Summary: Guest state "crashed" does not get updated after "virsh reset"
Product: Red Hat Enterprise Linux 7 Reporter: Thomas Huth <thuth>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: abologna, dyuan, dzheng, fjin, gsun, mkletzan, mzhan, rbalakri, yafu
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-2.0.0-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:25:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Huth 2015-10-07 15:04:28 UTC
Description of problem:
The state of a crashed guest does not get updated after rebooting it via "virsh reset"

Version-Release number of selected component (if applicable):
libvirt-client-1.2.17-12.el7.ppc64le
qemu-kvm-rhev-2.3.0-28.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:
1. Edit the XML definition of a guest so that it does not reboot
   automatically when it crashed:
     <on_crash>preserve</on_crash>
2. Start the guest and crash it by typing the following from the
   guest console:
     echo c > /proc/sysrq-trigger
3. Use "virsh list" from the host to check that the guest is
   in the "crashed" state
4. Reboot the guest by using "virsh reset" from the host
5. Issue "virsh list" again to check the state of the guest

Actual results:
The guest state is still shown as "crashed"

Expected results:
The guest state should be shown as "running" again

Comment 2 Martin Kletzander 2016-07-14 12:33:05 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2016-July/msg00439.html

Comment 3 Martin Kletzander 2016-08-02 11:38:36 UTC
Fixed upstream with v2.1.0-rc1-34-gdaf01a61254c:

commit daf01a61254cc21d90e15dae8080f13e9a34b489
Author: Martin Kletzander <mkletzan>
Date:   Wed Jul 13 16:13:58 2016 +0200

    qemu: Fix domain state after reset

Comment 6 Fangge Jin 2016-08-15 09:24:06 UTC
Reproduce this BZ on build libvirt-2.0.0-4.el7.x86_64

Steps:
0. Prepare a guest as below:
# virsh dumpxml rhel7
...
  <features>
    <acpi/>
    <apic/>
    <pmu state='on'/>
  </features>
...
  <on_crash>preserve</on_crash>
...


1. Start guest

2. In guest, # echo c > /proc/sysrq-trigger

3. Check guest status:
# virsh list
 Id    Name                           State
----------------------------------------------------
 6     rhel7                          crashed

4.Reset guest, and check status:
# virsh reset rhel7
Domain rhel7 was reset

# virsh list
 Id    Name                           State
----------------------------------------------------
 6     rhel7                          crashed

Comment 7 Fangge Jin 2016-08-15 09:33:51 UTC
Verify pass on build libvirt-2.0.0-5.el7.x86_64

Steps:
0. Prepare a guest as below:
# virsh dumpxml rhel7
...
  <features>
    <acpi/>
    <apic/>
    <pmu state='on'/>
  </features>
...
  <on_crash>preserve</on_crash>
...
    <panic model='isa'>
      <address type='isa' iobase='0x505'/>
    </panic>
...

1. Start guest

2. In guest: # echo c > /proc/sysrq-trigger

3. Check guest status
# virsh list
 Id    Name                           State
----------------------------------------------------
 80    rhel7                          crashed

# virsh domstate rhel7 --reason
crashed (panicked)

4. Reset guest and check guest status again:

# virsh reset rhel7
Domain rhel7 was reset

# virsh list
 Id    Name                           State
----------------------------------------------------
 80    rhel7                          paused

# virsh domstate rhel7 --reason
paused (crashed)

5.Resume guest and check guest status again:

# virsh resume rhel7
Domain rhel7 resumed

# virsh list
 Id    Name                           State
----------------------------------------------------
 80    rhel7                          running

# virsh domstate rhel7 --reason
running (unpaused)

Comment 8 Fangge Jin 2016-08-15 09:41:34 UTC
Hi Martin,

I have a question, why the guest is paused instead of running after reset?

Thank you!

Comment 9 Martin Kletzander 2016-08-15 11:17:20 UTC
Because that's how QEMU behaves.  You can start it afterwards normally.  Also the output of 'virsh domstate --reason' should be paused (crashed).

Comment 11 errata-xmlrpc 2016-11-03 18:25:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2577.html