Bug 1363627

Summary: Provide proper error messages when hot-plugging devices into a not hot-pluggable pci controller
Product: Red Hat Enterprise Linux 7 Reporter: Yang Yang <yanyang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: dyuan, laine, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-2.0.0-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:51:22 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 Yang Yang 2016-08-03 08:59:22 UTC
Description of problem:
I hot-plug devices into a not hot-pluggable pci controller, such as
pcie-root, dmi-to-pci-bridge, pxb-pcie. The error messages confuse
me, like this:

# virsh attach-device vm1-q35 nic.xml
error: Failed to attach device from nic.xml
error: internal error: PCI bus is not compatible with the device at 0000:01:1f.0. Device requires hot-plug capability, which is not provided by bus 0000:01

If we're sure they do not support hotplug, we should
provide proper error message like "pxb-pcie does not have hotpluggable slot"

Version-Release number of selected component (if applicable):
libvirt-2.0.0-4.el7.x86_64
qemu-kvm-rhev-2.6.0-18.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start vm with pcie-root -- dmi-to-pci-birdge -- pci-bridge
<controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <model name='i82801b11-bridge'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <model name='pci-bridge'/>
      <target chassisNr='2'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>

2. hot-plug 1 nic into dmi-to-pci-bridge
# virsh attach-device vm1-q35 nic.xml
error: Failed to attach device from nic.xml
error: internal error: PCI bus is not compatible with the device at 0000:01:1f.0. Device requires hot-plug capability, which is not provided by bus 0000:01

# cat nic.xml
<interface type='network'>
      <source network='default' bridge='virbr0'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x1f' function='0x0'/>
    </interface>

Actual results:
The error messages confuse me

Expected results:
Provide proper error messages when hotplugging devices into a not hot-pluggable pci controller, such as pcie-root, dmi-to-pci-bridge, pxb-pcie.

Additional info:

Comment 2 Laine Stump 2016-08-10 15:06:24 UTC
Fix pushed upstream:

commit 10031fe5f218fe0acbf873a3063ce42a02fa83d9
Author: Laine Stump <laine>
Date:   Fri Aug 5 21:19:27 2016 -0400

    conf: improve error log when PCI devices don't match requested controller

Comment 5 Yang Yang 2016-08-15 09:03:14 UTC
Verified on libvirt-2.0.0-5.el7.x86_64

1. Hotplug device into dmi-to-pci-bridge
# virsh attach-disk vm1-q35 /mnt/nfs2/virtio1.img vdb --subdriver qcow2 --targetbus virtio --address pci:0.1.1f.0
error: Failed to attach disk
error: internal error: The device at PCI address 0000:01:1f.0 requires hotplug capability, but the PCI controller with index='1' doesn't support hotplug

2. Hotplug device into pcie-root
 # virsh attach-disk vm1-q35 /mnt/nfs2/virtio1.img vdb --subdriver qcow2 --targetbus virtio --address pci:0.0.1f.0
error: Failed to attach disk
error: internal error: The device at PCI address 0000:00:1f.0 cannot be plugged into the PCI controller with index='0'. It requires a controller that accepts a standard PCI device.
	 
3. Hotplug device into upstream port 
# virsh attach-disk vm1-q35 /mnt/nfs2/virtio1.img vdb --subdriver qcow2 --targetbus virtio --address pci:0.4.1f.0
error: XML error: The device at PCI address 0000:04:1f.0 cannot be plugged into the PCI controller with index='4'. It requires a controller that accepts a standard PCI device.

4. Hotplug device into pxb-pcie
# virsh attach-disk vm1-q35-pxb /mnt/nfs2/virtio2.img vdb --subdriver qcow2 --address pci:0.3.0.0
error: Failed to attach disk
error: XML error: The device at PCI address 0000:03:00.0 cannot be plugged into the PCI controller with index='3'. It requires a controller that accepts a standard PCI device.

I got error when hotplugging devices into a not hot-pluggable bus. For the hottpluggable bus, e.g. root-port and downstream-port, I got error like above as well. I have a separate bug1337490 to track.

Comment 7 errata-xmlrpc 2016-11-03 18:51:22 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