Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 981546

Summary: the vfs should be clear up while there isn't any vfs on the host
Product: Red Hat Enterprise Linux 7 Reporter: Xuesong Zhang <xuzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dyuan, honzhang, mzhan, rbalakri, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.16-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:43:29 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 Xuesong Zhang 2013-07-05 06:41:55 UTC
Description of problem:
The VFs in nodedev-dumpxml should be clear up while the VFs are not exist in the host.

Version-Release number of selected component (if applicable):
libvirt-1.1.0-1.el7.x86_64
qemu-kvm-1.5.0-2.el7.x86_64
3.10.0-0.rc5.61.el7.x86_64

How reproducible:
100%

Steps:
1. prepare one SR-IOV, check the vfs and pfs on this host.
# lspci|grep 82576
03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:10.0 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.2 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.3 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.4 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.5 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)

2. check the vfs of pf "03:00.0" with command nodedev-dumpxml.
# virsh nodedev-dumpxml  pci_0000_03_00_0
<device>
  <name>pci_0000_03_00_0</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:00.0</path>
  <parent>pci_0000_00_01_0</parent>
  <driver>
    <name>igb</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x10c9'>82576 Gigabit Network Connection</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='virt_functions'>------------------------------------------Here are the VFs of this PF.
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x2'/>
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x4'/>
    </capability>
    <iommuGroup number='14'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </iommuGroup>
  </capability>
</device>

3. delete these vfs, there aren't any vfs on this host now.
# rmmod igb
# lspci|grep 82576
03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

4. check the dumpxml of this PF again.
# virsh nodedev-dumpxml pci_0000_03_00_0
<device>
  <name>pci_0000_03_00_0</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:00.0</path>
  <parent>pci_0000_00_01_0</parent>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x10c9'>82576 Gigabit Network Connection</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='virt_functions'>---------------------------------------should not exist any vfs.
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x2'/>
      <address domain='0x0000' bus='0x03' slot='0x10' function='0x4'/>
    </capability>
    <iommuGroup number='14'>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </iommuGroup>
  </capability>
</device>

Actual results:
in step4, the vfs are still existed in the nodedev-dumpxml while there isn't any vfs.

Expected results:
The VFs in the node-dumpxml should not be shown up while there isn't any VFs on the host.

Comment 2 Laine Stump 2014-06-18 10:07:43 UTC
Sigh. caching device information at libvirtd start turns out to not be a very good idea. A tiny amount of time is saved and in return we run the risk of providing stale data.(There has already been at least one other bug due to this caching - see Bug 979290.

The virtual fuinctions list will need to be updated from the function update_caps().

Comment 5 Laine Stump 2015-05-06 16:20:29 UTC
*** Bug 1142642 has been marked as a duplicate of this bug. ***

Comment 6 Laine Stump 2015-05-23 16:27:04 UTC
The following patches have been pushed upstream to resolve the issue:

commit ffc40b63b50ecb2c60fbd27372daf00f71071958
Author: Laine Stump <laine>
Date:   Fri May 8 12:55:00 2015 -0400

    conf: make virNodeDevCapData an official type
    
commit 3c93419b7771bf42ba7b56803f5b2ce480854791
Author: Laine Stump <laine>
Date:   Wed May 6 13:51:47 2015 -0400

    nodedev: change if-else if in update_caps to switch
    
commit d2a57815aa2a1a299a690f6622e1c77f46c883bb
Author: Laine Stump <laine>
Date:   Wed May 6 16:40:39 2015 -0400

    node device: prepare node_device_linux_sysfs.c to add more functions
    
commit 7349fa2ebef2f26946c8280ed4c6cc1ef7e2e3cc
Author: Laine Stump <laine>
Date:   Mon May 11 13:35:50 2015 -0400

    node_device: new functions to get sriov/iommu info from sysfs
    
commit 601b0fa872136951cd7d0745d99cfb1359367b0f
Author: Laine Stump <laine>
Date:   Mon May 11 13:40:21 2015 -0400

    node_device: update sriov/iommu info before dumpxml of a device
    
commit d52d7a64b083645cbd355a34476963d1623b617a
Author: Laine Stump <laine>
Date:   Mon May 11 13:50:37 2015 -0400

    node_device: replace duplicated code in hal and udev backends

Comment 8 Shanzhi Yu 2015-07-16 07:32:45 UTC
Verify this bug with libvirt-1.2.17-2.el7.x86_64

Steps: 

1. 
#lspci|grep 82576
03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:10.0 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.2 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
03:10.3 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)

2. 
# virsh nodedev-dumpxml pci_0000_03_10_0 
<device>
  <name>pci_0000_03_10_0</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:10.0</path>
  <parent>pci_0000_00_01_0</parent>
  <driver>
    <name>vfio-pci</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>16</slot>
    <function>0</function>
    <product id='0x10ca'>82576 Virtual Function</product>
..


# virsh nodedev-dumpxml pci_0000_03_10_1
<device>
  <name>pci_0000_03_10_1</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:10.1</path>
  <parent>pci_0000_00_01_0</parent>
  <driver>
    <name>igbvf</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>16</slot>
    <function>1</function>
    <product id='0x10ca'>82576 Virtual Function</product>
..

# virsh nodedev-dumpxml pci_0000_03_10_2
<device>
  <name>pci_0000_03_10_2</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:10.2</path>
  <parent>pci_0000_00_01_0</parent>
  <driver>
    <name>vfio-pci</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>16</slot>
    <function>2</function>
    <product id='0x10ca'>82576 Virtual Function</product>
..

# virsh nodedev-dumpxml pci_0000_03_10_3
<device>
  <name>pci_0000_03_10_3</name>
  <path>/sys/devices/pci0000:00/0000:00:01.0/0000:03:10.3</path>
  <parent>pci_0000_00_01_0</parent>
  <driver>
    <name>igbvf</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>3</bus>
    <slot>16</slot>
    <function>3</function>
    <product id='0x10ca'>82576 Virtual Function</product>
..

3. 
#rmmod igb
#lspci|grep 82576
03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

4. 
#virsh nodedev-dumpxml pci_0000_03_10_3
error: Could not find matching device 'pci_0000_03_10_3'
error: Node device not found: no node device with matching name 'pci_0000_03_10_3'

#virsh nodedev-dumpxml pci_0000_03_10_2
error: Could not find matching device 'pci_0000_03_10_2'
error: Node device not found: no node device with matching name 'pci_0000_03_10_2'

#virsh nodedev-dumpxml pci_0000_03_10_1
error: Could not find matching device 'pci_0000_03_10_1'
error: Node device not found: no node device with matching name 'pci_0000_03_10_1'

#virsh nodedev-dumpxml pci_0000_03_10_0
error: Could not find matching device 'pci_0000_03_10_0'
error: Node device not found: no node device with matching name 'pci_0000_03_10_0'

Comment 10 errata-xmlrpc 2015-11-19 05:43:29 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/RHBA-2015-2202.html