Red Hat Bugzilla – Bug 479622
libvirt should avoid creating virtual networks with the same bridge name
Last modified: 2009-11-18 08:52:18 EST
Description of problem:
When setting many virtual networks with virt-manager on a kvm host, and activating them at boot, only one really starts at boot (the last you defined). You have to manually shut this one off (in virt-manager), and then start all the virtual networks. Seems that each of the virtual networks want to be named as virbr0, libvirt doesn't check if the network if name is already in use?
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Open virt-manager and connect to the host, details -> virtual network
2. Add one virtual network with a new network address range and check "at boot"
4. ifconfig only shows one virbr0
Only the last defined virtual network seems to be up at boot
All the "activated at boot" virtual networks should be up
In virt-manager there is an input text widget for the network name but you can't enter any thing...
When you try to activate the other virtual network it says virbr0 already exists... have to shut the active virtual network and then start all the virtual-networks manually.
virsh # net-list --all
Nom État Démarrage automatique
reseau_interne actif yes
default inactif yes
virsh # net-dumpxml default
<bridge name='virbr0' stp='on' forwardDelay='0' />
<ip address='192.168.122.1' netmask='255.255.255.0'>
<range start='192.168.122.2' end='192.168.122.254' />
virsh # net-dumpxml reseau_interne
<bridge name='virbr0' stp='on' forwardDelay='0' />
<ip address='192.168.100.1' netmask='255.255.255.0'>
<range start='192.168.100.128' end='192.168.100.254' />
Why the bridge name is the same?
Okay, there is definitely a legit bug here, not really sure what the proper fix is though.
Whenever a virtual network is brought up, it grabs the first available 'virbrX' interface. From that point on, it will _always_ try to grab that same interface, and if it can't, it errors out.
The 'default' network is always going to grab 'virbr0'. So what happens if you define a new virtual network and set it to autostart? If its name comes before 'default' alphabetically, when libvirtd starts up, the new network will grab 'virbr0', and then 'default' will fail to come up.
I think the reasonable solutions are:
1) Have network_driver.c:networkStartNetworkDaemon or bridge.c:brAddBridge be intelligent enough to fall back to a sequentially allocated bridge name if the hardcoded xml bridge name doesn't fly
2) Add some intelligence somewhere in the stack to not allocate a 'virbrX' interface to a new network if it is already present in another net's xml.
I think 2 is probably the way to go. Dan or Mark, any suggestions?
Dynamically assigning bridge name on each startup is not desirable - it won't work with Xen, because when we attach a guest to a virtual network, the bridge device name ends up in the Xen config. So we must guarentee that the same bridge device name is used on every boot. Really virt-manager should never create a network XML without an explicit bridge name.
libvirt however, should never have allowed 2 configs with the same bridge name to come into existance. When defining a new guest, or auto-allocating a bridge name, it must ensure it doesn't clash with any inactive network config, as well as the existing check against active bridges.
> Dynamically assigning bridge name on each startup is not desirable - it won't
> work with Xen, because when we attach a guest to a virtual network, the bridge
> device name ends up in the Xen config. So we must guarentee that the same
> bridge device name is used on every boot. Really virt-manager should never
> create a network XML without an explicit bridge name.
Seems reasonable that libvirt could also auto assign an unused bridge name to a network at define time, if the user doesn't specify one. That would save api users the hassle of reimplementing the collision detection. The code for generating a name of 'virbrX' is largely present anyways.
> libvirt however, should never have allowed 2 configs with the same bridge name
> to come into existance. When defining a new guest, or auto-allocating a bridge
> name, it must ensure it doesn't clash with any inactive network config, as well
> as the existing check against active bridges.
This was posted upstream
and included in 0.6.1 release.
NB, any existing defined virtual networks with clashing bridge names still won't work, but we have prevented any newly defined networks breaking in this way.
libvirt-0.6.1-1.fc10 has been pushed to the Fedora 10 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update libvirt'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-2396
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '10'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 10's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 10 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here:
libvirt-0.6.1 isn't pushed to stable, and is sitting in updates testing for F10. This bug won't be fixed in the stable f10 package, but is fixed in F11.
Moving to F11 and closing as CURRENTRELEASE.