[libvirt] [PATCH] network_conf: check sysfs if the bridge exists on host for user created bridges

Shivaprasad G Bhat shivaprasadbhat at gmail.com
Mon Mar 9 14:59:12 UTC 2015


The patch fixes the below problem.

==============================
If the bridge name is not mentioned in the <network> xml, the bridge name is
auto generated from virNetworkAllocateBridge(). If the default template named
bridge is created manually by a user, the bridge start will fail with
"File exists".

bash-4.3$ sudo brctl addbr virbr1

bash-4.3$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no
virbr0 8000.525400a91d03 yes virbr0-nic
virbr1 8000.000000000000 no

bash-4.3$ sudo virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     no            yes

bash-4.3$ cat /tmp/isolated # Notice that the <bridge> intentionally not given.
<network>
  <name>isolated</name>
  <forward/>    
  <ip address="192.168.123.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.123.2" end="192.168.123.254"/>
    </dhcp>
  </ip>
</network>

bash-4.3$ sudo virsh net-create /tmp/isolated
error: Failed to create network from isolated
error: Unable to create bridge virbr1: File exists
===============================

---

The following series implements...
Shivaprasad G Bhat (1):
      network_conf: check sysfs if the bridge exists on host for user created bridges


 src/conf/network_conf.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

--
Signature




More information about the libvir-list mailing list