[libvirt-users] [libvirt] how did libvirt manage Virtual Network?

Laine Stump laine at laine.org
Fri Sep 9 16:28:38 UTC 2011

(This seems more appropriate for the libvirt-users mailing list)

On 09/08/2011 10:16 PM, Wayne Xia wrote:
>     Working at the network management, I am a bit confused about the
> VLAN model in libvirt.
>     in the xml definition, there is a section as following:
> <devices>
> <interface type='network'>
> <source network='default'/>
> </interface>
>     ...
> <interface type='network'>
> <source network='default' portgroup='engineering'/>
> <target dev='vnet7'/>
> <mac address="00:11:22:33:44:55"/>
> <virtualport type='802.1Qbg'>
> <parameters managerid='11' typeid='1193047' typeidversion='2'
> instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
> </virtualport>
> </interface>
> </devices>
>     What is the really meaning of its related parameters of
> "virtualport"? I want to discover informations such as VLAN id,
> the switch type( software switch or hardware switch), connecting
> relationship, but from the xml I can only found "managerid". I am not 
> sure how to map these xml information to those I needed, could I 
> consider managerid as VLAN id, and a portgroup as a specified VLAN group?
>     By the way to use virtualport, what components should I install on
> Linux?

<virtualport> is used only when configuring guests that connect directly 
to a VEPA or VNLINK (i.e. 802.1Q) capable switch. Unless you have one of 
these switches, you will not use it. If you do have one of these 
switches, you will also have information included with them that 
explains the meaning of the virtualport parameters and how they are used 
(they're opaque to libvirt - it just passes them on to the switch 
without assigning any meaning to them).

portgroup is a tag used to select certain bits of config out of 
<portgroup> sections in the <network> definition being used for the 
interface. Currently the things that can be configured in the 
<portgroup> sections are 1) <bandwidth> info, and 2) <virtualport> 
parameters. Again, it has nothing to do with VLAN groups. <portgroup> is 
very new, btw - it has only been in libvirt since 0.9.4, so if you're 
using an older version don't expect it to do anything.

Down to the real basic question of which VLAN a particular guest is 
using - that can either be determined by the guest itself, or if the 
guest has no VLAN id setting, it could be determined by the 
switch/bridge the guest is connected to; in other words, wherever it is 
done, it's outside of libvirt (well, I guess if your platform has 
support for the iface-* commands, you could define a bridge that uses a 
vlan interface as its connection to the physical network - then traffic 
from any guest connected to that bridge would end up going onto the 
physical network with the given vlan id).

More information about the libvirt-users mailing list