[libvirt] [PATCHv2 4/9] network: save bridge name in ActualNetDef when actualType==network too
John Ferlan
jferlan at redhat.com
Tue Dec 2 21:16:34 UTC 2014
On 12/02/2014 12:08 PM, Laine Stump wrote:
> When the actualType of a virDomainNetDef is "network", it means that
> we are connecting to a libvirt-managed network (routed, natted, or
> isolated) which does use a bridge device (created by libvirt). In the
> past we have required drivers such as qemu to call the public API to
> retrieve the bridge name in this case (even though it is available in
> the NetDef's ActualNetDef if the actualType is "bridge" (i.e., an
> externally-created bridge that isn't managed by libvirt). There is no
> real reason for this difference, and as a matter of fact it
> complicates things for qemu. Also, there is another bridge-related
> attribute (fdb) that will need to be available in both cases, so this
> makes things consistent.
>
> In order to avoid problems when restarting libvirtd after an update
> from an older version that *doesn't* store the network's bridgename in
> the ActualNetDef, we also need to put it in place during
> networkNotifyActualDevice() (this function is run for each interface
> of each domain whenever libvirtd is restarted).
>
> Along with making the bridge name available in the internal object, it
> is also now reported in the <source> element of the <interface> state
> XML (or the <actual> subelement in the internally-stored format).
>
> The one oddity about this change is that usually there is a separate
> union for every different "type" in a higher level object (e.g. in the
> case of a virDomainNetDef there are separate "network" and "bridge"
> members of the union that pivots on the type), but in this case
> network and bridge types both have exactly the same attributes, so the
> "bridge" member is used for both type==network and type==bridge.
> ---
>
> Changes from V1:
>
> * populate actual.brname of an active interface when libvirtd is
> restarted, to avoid problems during upgrade.
>
> (John had asked questions about what happens during a save/restore or a
> migration; the answer is that everything in the <actual> is discarded
> as the interface is re-allocated/re-created, so there are no upgrade
> issues in that case.)
>
> src/conf/domain_conf.c | 102 +++++++++++++++++++++++---------------------
> src/network/bridge_driver.c | 20 +++++++++
> 2 files changed, 73 insertions(+), 49 deletions(-)
>
ACK
John
More information about the libvir-list
mailing list