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 1972468

Summary: Hotplugging a hostdev type interface succeeds, but the live xml is not updated accordingly
Product: Red Hat Enterprise Linux 9 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED CURRENTRELEASE QA Contact: yalzhang <yalzhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: fjin, jdenemar, jsuchane, pkrempa, virt-maint, xuzhang
Target Milestone: betaKeywords: Regression, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.5.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1972991 (view as bug list) Environment:
Last Closed: 2021-12-07 21:57:54 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: 7.5.0
Embargoed:
Bug Depends On:    
Bug Blocks: 1972991    

Description yalzhang@redhat.com 2021-06-16 01:58:50 UTC
Description of problem:
Hotplug hostev type interface succeed, but the live xml did not update accordingly

Version-Release number of selected component (if applicable):
libvirt-7.4.0-1.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a vm, then try to hotplug an hostdev interface, succeed:
# virsh start rhel
Domain 'rhel' started

# virsh domiflist rhel
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet0       network   default   e1000e   52:54:00:5d:da:04

# lspci | grep Virtual
82:10.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)

# virsh attach-interface rhel hostdev --managed 0000:82:10.0
Interface attached successfully

2. Check on the vm, the interface attached successfully:
[root@localhost ~]# ip l
......
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:5d:da:04 brd ff:ff:ff:ff:ff:ff
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:df:a2:14 brd ff:ff:ff:ff:ff:ff
[root@localhost ~]# ethtool -i enp4s0
driver: ixgbevf
version: 5.13.0-0.rc4.33.el9.x86_64

3. check the live xml, the hostdev interface do not exists, and domiflist did not show the hostdev interface:
# virsh domiflist rhel
 Interface   Type      Source    Model    MAC
-------------------------------------------------------------
 vnet0       network   default   e1000e   52:54:00:5d:da:04

# virsh dumpxml rhel | grep hostdev
(no outputs)

Actual results:
in step 3, no hostdev interface exists in the live xml after hotplug

Expected results:
The hostdev interface xml should exists in the vm's live xml

Additional info:
on such issue with libvirt-7.0.0-6.el9

Comment 2 Laine Stump 2021-06-17 12:58:41 UTC
Ah, I hadn't even noticed that this BZ (the original) had already been cloned and that I was commenting in the clone (as well as referencing the clone in my commit message) - my brain saw all the bugzilla-generated mails as a being a single BZ, and I commented on the one that I happened to click. I'll be pushing upstream with a reference to this BZ.

Comment 3 Laine Stump 2021-06-18 23:11:22 UTC
This is now pushed upstream:

commit 54b602019d7dfa94a6c52ef7aa3abdfaa93ed233
Author: Laine Stump <laine>
Date:   Thu Jun 17 01:14:27 2021 -0400

    qemu_hotplug: don't forget to add hostdev interfaces to the interface list

Comment 6 yalzhang@redhat.com 2021-07-14 05:36:10 UTC
Another scenario fail, need to test this scenario before verify the bug:
1. prepare network as below:
# virsh net-dumpxml hostdev-net
<network>
  <name>hostdev-net</name>
  <uuid>5485331a-6923-4fe8-b73e-3cd57319cd8e</uuid>
  <forward mode='hostdev' managed='yes'>
    <pf dev='enp130s0f1'/>
    <address type='pci' domain='0x0000' bus='0x82' slot='0x10' function='0x1'/>
    <address type='pci' domain='0x0000' bus='0x82' slot='0x10' function='0x3'/>
  </forward>
</network>

2. start a vm, then try to hotplug hostdev interface:
# virsh attach-interface rhel network hostdev-net 
Interface attached successfully

# virsh attach-interface rhel network hostdev-net 
Interface attached successfully

3. destroy the vm, and start it again, 
# virsh destroy rhel
Domain 'rhel' destroyed

after destroy, there is still connections='2' in the network xml:
# virsh net-dumpxml hostdev-net
<network connections='2'>
...

# virsh start rhel 
Domain 'rhel' started

4.try to hotplug, it will fail
# virsh attach-interface rhel network hostdev-net 
error: Failed to attach interface
error: internal error: network 'hostdev-net' requires exclusive access to interfaces, but none are available

# virsh nodedev-dumpxml pci_0000_82_10_1 | grep /driver -B2
  <driver>
    <name>ixgbevf</name>
  </driver>

Comment 10 yalzhang@redhat.com 2021-07-16 07:48:06 UTC
Test on libvirt-7.5.0-1.el9.x86_64 for the scenarios on comment 0 and comment 6, the result is as expected.