Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 558779

Summary: Hotplug physical host device to a running guest failed
Product: Red Hat Enterprise Linux 5 Reporter: zhanghaiyan <yoyzhang>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: clalance, jdenemar, virt-maint, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-01-27 09:03:39 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 zhanghaiyan 2010-01-26 12:37:11 UTC
Description of problem:
Hotplug virtual device to a running guest failed

Version-Release number of selected component (if applicable):
rhel5.4-server-x86_64-kvm
virt-manager-0.6.1-12.el5
kernel-2.6.18-164.el5
libvirt-0.6.3-30.el5
etherboot-zroms-kvm-5.4.4-13.el5
kvm-83-149.el5
kvm-qemu-img-83-149.el5
kmod-kvm-83-149.el5
etherboot-roms-kvm-5.4.4-10.el

How reproducible:
Always

Steps to Reproduce:
1. Find a virtual network card on the host
   # lspci |grep 82576
42:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
42:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
42:11.0 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
42:11.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
2. # lspci -n | grep 42:11.1
42:11.1 0200: 8086:10ca (rev 01)
3. # virsh nodedev-dumpxml pci_8086_10ca
<device>
  <name>pci_8086_10ca</name>
  <parent>pci_8086_340a</parent>
  <capability type='pci'>
    <domain>0</domain>
    <bus>66</bus>
    <slot>17</slot>
    <function>1</function>
    <product id='0x10ca'>82576 Virtual Function</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='phys_function'>
      <address domain='0x0000' bus='0x42' slot='0x00' function='0x1'/>
    </capability>
  </capability>
</device>
4. Detach this pci device on the host
   # virsh nodedev-dettach pci_8086_10ca
Device pci_8086_10ca dettached
5. In a running guest, add acpiphp module to ensure hotplug device could appear in the guest instantly
   # modprobe acpiphp
   # lsmod | grep acpiphp
   acpiphp     58841  0
6. Double click the running guest in virt-manager, select 'Hardware' tab, click 'Add Hardware', choose 'Physical Host Device' for Hardware type, click Forward, choose 'PCI Device' for Device Type and '42:11:! 82576 Virtual Function' for Device, click Forward, then click Finish
7. Click 'Yes' for the dialog


Actual results:
After step6, A waring dialog pops up saying 'Are you sure you want to add this devcie ? This device could not be attached to the running machine. Would you like to make the device availiable after the next VM shutdown ?'
After step7, the device is not listed in Hardware tab and cannot #lspci in the guest

Expected results:
After step 6, The virtual network device could be hotplug to guest and could #lspci the device in the guest

Additional info:
Could hotplug virtual device to a running guest with kvm command successfully

Comment 1 zhanghaiyan 2010-01-26 12:45:17 UTC
Addtional info for the above:
After shutdown the guest, and then start the guest, the virtual network card device is assigned to the guest, could #lspci the device in the guest and aslo can find it in guest xml config file

Comment 2 zhanghaiyan 2010-01-26 12:46:08 UTC
Hot unplug also failed
1. Double click a running with virtual network card guest in virt-manager, select 'Hardware' tab, highlight the virtual network card device, then click 'Remove'

Acutal result:
A waring dialog pops up saying 'Are you sure you want to remove this
devcie ? This device could not be removed from the running machine. Would you
like to remove the device after the next VM shutdown ?'

Comment 3 Chris Lalancette 2010-01-26 14:04:56 UTC
Could you try the test libvirt packages available at:

http://people.redhat.com/clalance/bz500217

There are a number of bugs in the RHEL-5 KVM PCI passthrough at the moment, and that package has fixes for most of them.  Remember to restart libvirtd after upgrading the packages, and then run your test again.

Thanks,
Chris Lalancette

Comment 4 Cole Robinson 2010-01-26 16:34:38 UTC
Also, ~/.virt-manager/virt-manager.log would show what the attach device failure was. Reassigning to libvirt in the interim.

Comment 5 zhanghaiyan 2010-01-27 02:21:50 UTC
libvirt package works well from http://people.redhat.com/clalance/bz500217
Both hotplug and hot unplug works well, of course with the help of acpiphp module

Will this bug be added to RHBA-2009:9133-02 - libvirt bug fix and enhancement update <https://errata.devel.redhat.com/errata/show/9133>

Comment 6 Jiri Denemark 2010-01-27 09:03:39 UTC
Yes, bug 500217 will be added into the current libvirt errata. I'm closing this bug as a duplicate.

*** This bug has been marked as a duplicate of bug 500217 ***