Fixed in this upstream commit:
Author: Laine Stump <email@example.com>
Date: Wed Mar 7 16:05:34 2012 -0500
qemu: support persistent hotplug of <hostdev> devices
For some reason, although live hotplug of <hostdev> devices is
supported, persistent hotplug is not. This patch adds the proper
VIR_DOMAIN_DEVICE_HOSTDEV cases to the switches in
qemuDomainAttachDeviceConfig and qemuDomainDetachDeviceConfig.
A backported fix has been posted to rhvirt-patches for inclusion in the RHEL build of libvirt:
Use libvirt-0.9.10-2.el6.x86_64 to reproduce the bug.
#virsh attach-device rhel6 hostdev.xml --persistent
error: Failed to attach device from hostdev.xml
error: unsupported configuration:persistent attach of device is not supported.
1.enable kernel iommu. edit grub.conf
add intel_iommu=on at the end of kernel line.
2.For platform just support vt-d1(host kernel) and host kernel
larger than 171 kernel, do the following steps.
modprobe -r kvm_intel
modprobe -r kvm
modprobe kvm allow_unsafe_assigned_interrupts=1
3.# rpm -q libvirt
4.Check device list, prepare hotplug network from host to guest.
| +- net_eth0_44_37_e6_67_11_a2
4.# virsh nodedev-dumpxml pci_0000_00_19_0
5. Prepare hostdev.xml that like as following
<hostdev mode='subsystem' type='pci' managed='yes'>
<address domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
5.# virsh attach-device rhel6 hostdev.xml --persistent
Device attached successfully
6. In guest, using lspci, and ping to check the host network device is working
7. # virsh destroy rhel6
8. # virsh start rhel6
9. The host network device still works fine in guest.
10. # virsh detach-device rhel6 hostdev.xml --persistent
Device detached successfully
The host network device automatically be re-attached to host.
11. # virsh destroy rhel6
12. # virsh start rhel6
The host network device don't exist in guest.
So it is verified.
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.
In previous versions of RHEL, a <hostdev> device could be hotplugged to a guest, but making that device persistent across restarts of the guest required separately editing the guest configuration. The patch that closes this bug adds support for persistent hotplug of <hostdev> devices, both to the libvirt API and to the virsh commandline utility.
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.