[netcf-devel] Support for VLAN interfaces

Daniel P. Berrange berrange at redhat.com
Tue Jun 30 09:57:13 UTC 2009


On Mon, Jun 29, 2009 at 10:33:23PM -0700, David Lutterkort wrote:
> 
> These patches add support for VLAN interfaces, both toplevel and enslaved
> to a bridge.
> 
> As previously discussed, VLAN interfaces only reference the underlying
> device, so that a brde br0 with a VLAN interface eth0.42 enslaved looks
> like
> 
>   <interface type="bridge" startmode="onboot">
>     <name>br0</name>
>     <protocol family="ipv4">
>       <dhcp/>
>     </protocol>
>     <bridge stp="off">
>       <interface type="vlan" device="eth0" vlan="42"/>
>     </bridge>
>   </interface>
> 
> Differing from other types of interfaces, the <name/> subtag is optional
> for VLAN's since it can be derived from the name of the underlying device
> and the  VLAN tag.

IMHO, the device & tag number should be nested tags to follow the
model used for other <interface> elements. eg, the only thing on
the <interface> element is the type attribute, and (for top level)
the startmode. The 'type' attribute designates what's valid for
the element content. eg

instead of

   <interface type="vlan" device="eth0" vlan="42"/>

it would be

   <interface type="vlan">
      <vlan tag="42">
        <interface>
           <name>eth0</name>
        </interface>
      </vlan>
   </interface>

This matches the nesting structure used for bridges, and bonding, so
making it easier to deal with the XML structure in applications.
eg, if you have an interface XML doc you can reliably extract any
dependant interface names with an Xpath "/interface/*/interface/name",
and not have to special case vlans by checking for an @device attribute
instead of nested 'name' element.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


More information about the netcf-devel mailing list