]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: make network driver vlan-aware
authorLaine Stump <laine@laine.org>
Mon, 13 Aug 2012 02:46:27 +0000 (22:46 -0400)
committerLaine Stump <laine@laine.org>
Wed, 15 Aug 2012 17:10:57 +0000 (13:10 -0400)
commit4eb4c6fad768cfc8dd7450df861f4e56b49f7b3e
tree837037bfeadc616986c12dfef0cdafe49e3f1988
parent3f9274a524804f8aa59c811932dba56550c120a1
network: make network driver vlan-aware

The network driver now looks for the vlan element in network and
portgroup objects, and logs an error at network define time if a vlan
is requested for a network type that doesn't support it. (Currently
vlan configuration is only supported for openvswitch networks, and
networks used to do hostdev assignment of SR-IOV VFs.)

At runtime, the three potential sources of vlan information are
examined in this order: interface, chosen portgroup, network, and the
first that is non-empty is used.  Another check for valid network type
is made at this time, since the interface may have requested a vlan (a
legal thing to have in the interface config, since it's not known
until runtime if the chosen network will actually support it).

Since we must also check for domains requesting vlans for unsupported
connection types even if they are type='network', and since
networkAllocateActualDevice() is being called in exactly the correct
places, and has all of the necessary information to check, I slightly
modified the logic of that function so that interfaces that aren't
type='network' don't just return immediately. Instead, they also
perform all the same validation for supported features. Because of
this, it's not necessary to make this identical check in the other
three places that would normally require it: 1) qemu domain startup,
2) qemu device hotplug, 3) lxc domain startup.

This can be seen as a first step in consolidating network-related
functionality into the network driver, rather than having copies of
the same code spread around in multiple places; this will make it
easier to split the network parts off into a separate daemon, as we've
discussed recently.
src/network/bridge_driver.c