Bug 1146310

Summary: guest interface which use existing bridge source bridge will disappear after libvirtd restart
Product: Red Hat Enterprise Linux 6 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: dyuan, lhuang, mzhan, phrdina, rbalakri, virt-bugs
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-47.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1140085 Environment:
Last Closed: 2015-07-22 05:47:41 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:
Bug Depends On: 1140085    
Bug Blocks:    

Description Luyao Huang 2014-09-25 01:25:07 UTC
This bug also can be reproduced in RHEL6,so clone a new bug for RHEL6.7
and Version-Release of RHEL6:
libvirt-0.10.2-46.el6.x86_64

+++ This bug was initially created as a clone of Bug #1140085 +++

Description of problem:
guest interface which use existing bridge source bridge will disappear after libvirtd restart

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

How reproducible:
100%

Steps to Reproduce:
1.prepare a virtual network which use host exist bridge
# virsh net-dumpxml host-bridge
<network connections='2'>
  <name>host-bridge</name>
  <uuid>3b251430-0eb4-4670-96e5-9ddd6d0bd90f</uuid>
  <forward mode='bridge'/>
  <bridge name='br13'/>
</network>

2.# brctl show
bridge name        bridge id                STP enabled        interfaces
br13                8000.525400094d3f        no                br13-nic
                                                                


3.# virsh net-start host-bridge
Network host-bridge started

4.prepare a running guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 13    test3                          running

5.# virsh attach-interface test3 network host-bridge
Interface attached successfully

6.# virsh dumpxml test3
    <interface type='bridge'>
      <mac address='52:54:00:d3:16:22'/>
      <source bridge='br13'/>
      <target dev='vnet2'/>
      <model type='rtl8139'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </interface>

7.# brctl show
bridge name        bridge id                STP enabled        interfaces
br13                8000.525400094d3f        no                br13-nic
                                                                vnet2

8.# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

9.# virsh dumpxml test3
    <interface type='bridge'>
      <mac address='52:54:00:d3:16:22'/>
      <target dev='vnet2'/>
      <model type='rtl8139'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </interface>

10.# virsh domiflist test3
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet2      bridge     -          rtl8139     52:54:00:d3:16:22




11.
# brctl show
bridge name        bridge id                STP enabled        interfaces
br13                8000.525400094d3f        no                br13-nic
                                                                vnet2

12.some virsh command cannot be used 
#virsh detach-interface test3 network 52:54:00:d3:16:22
error: Failed to detach interface
error: internal error: No <source> 'bridge' attribute specified with <interface type='bridge'/>

Actual results:
guest interface which use existing bridge source bridge will disappear after libvirtd restart

Expected results:
source bridge should not disappear after libvirtd restart

Additional info:

Comment 3 Hu Jianwei 2014-12-16 04:02:04 UTC
Verified as below:

[root@hp-dl385g7-05 ~]# rpm -q libvirt qemu-kvm
libvirt-0.10.2-47.el6.x86_64
qemu-kvm-0.12.1.2-2.445.el6.x86_64

<1>
[root@hp-dl385g7-05 ~]# virsh net-dumpxml host-bridge
<network>
  <name>host-bridge</name>
  <uuid>f0715f65-53e1-c56c-66f2-4c99e3812bbd</uuid>
  <forward mode='bridge'/>
  <bridge name='br99' />
</network>

[root@hp-dl385g7-05 ~]# virsh net-list --all
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes
host-bridge          active     no            yes

[root@hp-dl385g7-05 ~]# virsh net-dumpxml host-bridge
<network>
  <name>host-bridge</name>
  <uuid>f0715f65-53e1-c56c-66f2-4c99e3812bbd</uuid>
  <forward mode='bridge'/>
  <bridge name='br99' />
</network>

[root@hp-dl385g7-05 ~]# brctl show
bridge name	bridge id		STP enabled	interfaces
br99		8000.000000000000	no		
virbr0		8000.5254003c535f	yes		virbr0-nic
[root@hp-dl385g7-05 ~]# 
[root@hp-dl385g7-05 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r6                             running

[root@hp-dl385g7-05 ~]# virsh attach-interface r6 network host-bridge
Interface attached successfully

[root@hp-dl385g7-05 ~]# virsh dumpxml r6| grep \<interface -A5
    <interface type='bridge'>
      <mac address='52:54:00:14:2e:24'/>
      <source bridge='br99'/>
      <target dev='vnet1'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
[root@hp-dl385g7-05 ~]# brc
brcm_iscsiuio  brctl          
[root@hp-dl385g7-05 ~]# brctl show
bridge name	bridge id		STP enabled	interfaces
br99		8000.fe5400142e24	no		vnet1
virbr0		8000.5254003c535f	yes		virbr0-nic
[root@hp-dl385g7-05 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@hp-dl385g7-05 ~]# virsh dumpxml r6| grep \<interface -A5
    <interface type='bridge'>
      <mac address='52:54:00:14:2e:24'/>
      <source bridge='br99'/>
      <target dev='vnet1'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
[root@hp-dl385g7-05 ~]# virsh domiflist r6
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet1      bridge     br99       -           52:54:00:14:2e:24

[root@hp-dl385g7-05 ~]# virsh detach-interface r6 bridge 52:54:00:14:2e:24
Interface detached successfully

[root@hp-dl385g7-05 ~]# virsh dumpxml r6| grep \<interface -A5
[root@hp-dl385g7-05 ~]# 


<2> Error message checking(Only for testing the error message output, force to remove below lines from /var/run/libvirt/qemu/r6.xml invalidly)
+++++++++++++++++++
        <actual type='bridge'>
          <source bridge='br99'/>
        </actual>
+++++++++++++++++++

[root@hp-dl385g7-05 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     r6                             running

[root@hp-dl385g7-05 ~]# virsh attach-interface r6 network host-bridge
Interface attached successfully

[root@hp-dl385g7-05 ~]# vim /var/run/libvirt/qemu/r6.xml
[root@hp-dl385g7-05 ~]# virsh dumpxml r6| grep \<interface -A5
    <interface type='bridge'>
      <mac address='52:54:00:0c:8b:ef'/>
      <source bridge='br99'/>
      <target dev='vnet1'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
[root@hp-dl385g7-05 ~]# > /var/log/libvirt/libvirtd.log 
[root@hp-dl385g7-05 ~]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]
[root@hp-dl385g7-05 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     r6                             shut off

[root@hp-dl385g7-05 ~]# cat /var/log/libvirt/libvirtd.log 
2014-12-16 03:54:59.861+0000: 11362: info : libvirt version: 0.10.2, package: 47.el6 (Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>, 2014-12-11-07:56:01, x86-022.build.eng.bos.redhat.com)
2014-12-16 03:54:59.861+0000: 11362: error : virDomainActualNetDefParseXML:4943 : internal error Missing <source> element with bridge name in interface's <actual> element
[root@hp-dl385g7-05 ~]#

Comment 5 errata-xmlrpc 2015-07-22 05:47:41 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-1252.html