Bug 1140085

Summary: guest interface which use existing bridge source bridge will disappear after libvirtd restart
Product: Red Hat Enterprise Linux 7 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: 7.1CC: dyuan, jiahu, lcheng, lhuang, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.8-4.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1146310 (view as bug list) Environment:
Last Closed: 2015-03-05 07:44:15 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:    
Bug Blocks: 1146310    

Description Luyao Huang 2014-09-10 09:43:16 UTC
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 2 Pavel Hrdina 2014-09-24 10:01:17 UTC
Fixed upstream

commit a71f741ec57634957adcac8a59b1ef27641580ad
Author: Pavel Hrdina <phrdina>
Date:   Thu Sep 18 15:06:44 2014 +0200

    Fix bug with loading bridge name for active domain during libvirtd start
    
    If you have a bridge network in running domain and libvirtd is restarted
    the information about host bridge interface is lost from live xml.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140085
    
    Signed-off-by: Pavel Hrdina <phrdina>

Comment 4 Luyao Huang 2014-09-25 01:27:13 UTC
Also found this issue with the latest RHEL6 libvirt,so clone a bug 1146310 for RHEL6.

Comment 6 lcheng 2014-11-17 10:15:18 UTC
Verify it as follows. The result is expected.


Version:
libvirt-1.2.8-6.el7.x86_64
qemu-kvm-rhev-2.1.2-8.el7.x86_64
qemu-kvm-1.5.3-79.el7.x86_64


Steps:
1. 
# virsh net-dumpxml host-bridge
<network>
  <name>host-bridge</name>
  <uuid>3b251430-0eb4-4670-96e5-9ddd6d0bd90f</uuid>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>

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

3. 
# brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.10604b5cb9e7	no		eno1
virbr0		8000.52540093da52	yes		virbr0-nic

4. 							vnet0
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 19    a                              running

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

6.
# virsh dumpxml a | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:bb:25:71'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:22:07:a9'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='rtl8139'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
...

7.
# brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.10604b5cb9e7	no		eno1
							vnet1
virbr0		8000.52540093da52	yes		virbr0-nic
							vnet0
8.
# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

9.
# virsh dumpxml a | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:bb:25:71'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='bridge'>
      <mac address='52:54:00:22:07:a9'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='rtl8139'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
...

10.
# virsh domiflist a
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet0      network    default    rtl8139     52:54:00:bb:25:71
vnet1      bridge     br0        rtl8139     52:54:00:22:07:a9

11.
# brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.10604b5cb9e7	no		eno1
							vnet1
virbr0		8000.52540093da52	yes		virbr0-nic
							vnet0
12.
# virsh detach-interface a bridge 52:54:00:22:07:a9
Interface detached successfully

Comment 8 errata-xmlrpc 2015-03-05 07:44:15 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-2015-0323.html