Bug 747619

Summary: Host PCI device's original states are not honored anymore after deamon is restarted
Product: Red Hat Enterprise Linux 6 Reporter: Osier Yang <jyang>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, ajia, dallan, dyuan, mzhan, rwu, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.9-1.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:35:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Osier Yang 2011-10-20 14:17:40 UTC
Description of problem:
To support "managed" mode of host PCI device, we record the original
states (unbind_from_stub, remove_slot, and reprobe) so that could
reattach the device to host with original driver. But there is no XML
for theses attrs, and thus after daemon is restarted, we lose the
original states. It's easy to reproduce:

    1) virsh start domain
    2) virsh attach-device dom hostpci.xml (in 'managed' mode)
    3) service libvirtd restart
    4) virsh destroy domain

    You will see the device won't be bound to the original driver
if there was one.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 5 Alex Jia 2011-10-28 09:17:54 UTC
Osier, if virsh attach-device support --persistent option, whether this issue can be resolved?

Comment 6 Alex Jia 2011-10-28 09:30:50 UTC
I can reproduce this issue on rhel6.2 with libvirt-0.9.4-14.el6_x86_64, although managed mode is yes, the device can't be returned to host after destroying or shutting down the guest.

Comment 8 Osier Yang 2011-11-22 09:32:48 UTC
patch committed to upstream.

Comment 9 Osier Yang 2012-01-09 08:35:43 UTC
commit d84b36263c5c54df8ebfaebbe099afec78c14fac
Author: Osier Yang <jyang>
Date:   Thu Oct 20 17:50:10 2011 +0800

    qemu: Restore the original states of PCI device when restarting daemon
    
    To support "managed" mode of host PCI device, we record the original
    states (unbind_from_stub, remove_slot, and reprobe) so that could
    reattach the device to host with original driver. But there is no XML
    for theses attrs, and thus after daemon is restarted, we lose the
    original states. It's easy to reproduce:
    
        1) virsh start domain
        2) virsh attach-device dom hostpci.xml (in 'managed' mode)
        3) service libvirtd restart
        4) virsh destroy domain
    
        You will see the device won't be bound to the original driver
    if there was one.

    ......

Comment 11 weizhang 2012-01-10 09:11:20 UTC
verify pass on
libvirt-0.9.9-1.el6.x86_64
kernel-2.6.32-225.el6.x86_64
qemu-kvm-0.12.1.2-2.213.el6.x86_64

After restart libvirtd and destroy guest, the pci device will return to host

Comment 12 Osier Yang 2012-05-04 10:03:49 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.

Comment 14 errata-xmlrpc 2012-06-20 06:35:26 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.

http://rhn.redhat.com/errata/RHSA-2012-0748.html