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 1518148

Summary: Fail to attach interface after libvirtd restart
Product: Red Hat Enterprise Linux 7 Reporter: Jingjing Shao <jishao>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: yalzhang <yalzhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: dyuan, jiyan, jtomko, lmiksik, rbalakri, xuzhang, yafu, yalzhang
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.9.0-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 11:00:58 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:
Attachments:
Description Flags
Problematic vm xml none

Description Jingjing Shao 2017-11-28 10:32:44 UTC
Description of problem:
Fail to attach interface after libvirtd restart

Version-Release number of selected component (if applicable):
libvirt-3.9.0-3.virtcov.el7.x86_64

How reproducible:
100%

Steps to reproduce:
1. Prepare a running guest with info as below
# virsh dumpxml rhel | grep /interface  -B7
    <interface type='network'>
      <mac address='52:54:00:c2:66:40'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>


2.Restart the libvirtd
# service libvirtd restart
Redirecting to /bin/systemctl restart libvirtd.service


3. Attach the interface
#  virsh attach-interface rhel network default
error: Failed to attach interface
error: internal error: unable to execute QEMU command 'device_add': Bus 'pci' not found


Actual results:
As the step3 shows


Expected results:
Interface attached successfully


Addtional info:

Test on libvirt-3.9.0-2.el7.x86_64 no such issue

Comment 3 Ján Tomko 2017-11-28 13:53:19 UTC
Proposed upstream patch:
https://www.redhat.com/archives/libvir-list/2017-November/msg01139.html

Comment 5 Ján Tomko 2017-11-30 16:07:27 UTC
Pushed upstream as:
commit 309cd46b400d80420615b19adfebf7158492ae3b
    Introduce virDomainDeviceAliasIsUserAlias

commit dacfc6b10bcff1c275d21a37edf0bc83e0947492
    qemu: prefer the PCI bus alias from status XML

commit fdf354fb51e7f00b582d0daa18961d432155df83
    virQEMUCapsHasPCIMultiBus: use def->os.arch

commit 65108d94d093de082dc5a2d4a73844dd569506db
CommitDate: 2017-11-30 16:49:05 +0100

    virQEMUCapsHasPCIMultiBus: assume true if we have no version information

git describe: v3.10.0-rc1-9-g65108d94d

Comment 7 yalzhang@redhat.com 2017-12-01 14:02:05 UTC
Hi Ján Tomko,

I have test the scratch build with latest qemu-kvm-rhev-2.10.0-10.el7.x86_64 on a new created vm, it works well. 

But on one other vm, the hotplug always fail, coldplug is ok. 
I tried to find the difference between the 2 vm's xml, but can not find any clue. Then I tried on another host with the problematic xml, it still fail with the scratch build.The error message says:

# virsh attach-interface rhel7.4 network default
error: Failed to attach interface
error: internal error: unable to execute QEMU command 'device_add': Bus 'pci.0' does not support hotplugging

And I attached the problematic xml, could you please help to debug?

Comment 8 yalzhang@redhat.com 2017-12-01 14:04:10 UTC
Created attachment 1361609 [details]
Problematic vm xml

Problematic vm xml

Comment 9 Ján Tomko 2017-12-01 14:10:15 UTC
ACPI needs to be enabled for PCI hotplug: (I'm not sure if it can work through SHPC without ACPI)
<features>
  <acpi/>
</features>

Comment 10 jiyan 2017-12-04 10:25:56 UTC
Same issue for virtio input device
https://bugzilla.redhat.com/show_bug.cgi?id=1509866#c11

Comment 12 yalzhang@redhat.com 2018-01-14 07:09:16 UTC
Test on libvirt-3.9.0-7.el7.x86_64, the bug is fixed. Set it as verified.

1. 
# virsh dumpxml rhel | grep /interface -B9

# systemctl restart libvirtd

# virsh attach-interface rhel network default --model virtio --mac 52:54:00:8f:c2:f1
Interface attached successfully

# virsh dumpxml rhel | grep /interface -B7
    <interface type='network'>
      <mac address='52:54:00:8f:c2:f1'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

2. restart libvirtd, then attach device with alias name
# systemctl restart libvirtd
# cat inter.xml
<interface type='network'>
      <source network='default' bridge='virbr0'/>
      <model type='virtio'/>
<alias name='ua-myinterface'/>    
</interface>

# virsh attach-device rhel inter.xml 
Device attached successfully

# virsh dumpxml rhel | grep /interface -B7
    <interface type='network'>
      <mac address='52:54:00:8f:c2:f1'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:2b:bb:d4'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='ua-myinterface'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

Comment 16 errata-xmlrpc 2018-04-10 11:00:58 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://access.redhat.com/errata/RHEA-2018:0704