[libvirt-users] Attach libvirt guest to an existing openvswitch port

Laine Stump laine at laine.org
Mon Nov 21 18:46:25 UTC 2016


On 11/13/2016 01:23 PM, Ivan Borodin wrote:
> Good day gentlemen.
> I am building a study project and trying to configure openvswitch vlans
> outside libvirt by means of openvswitch itself.
>
> Somehow with interface types 'bridge' and 'network', libvirt does attach
> domain to the existing port specified in <target dev=''/>, wiping the
> exixting settings and always deletes this port upon domain shutdown,
> thus making me loose ovs configuration.
>
> Could you, please, tell me how should I configure an interface

You can set the vlan tag for an interface plugged into an OVS switch 
with the <vlan> tag:

      <interface type='bridge'>
         <source bridge='ovsbr0'/>
         <virtualport type='openvswitch'>
            <parameters interfaceid='.....'/>
         <virtualport>
         <vlan>
              <tag id='42'/>
         </vlan>

http://www.libvirt.org/formatdomain.html#elementVlanTag

(if you want vlan trunking, you can use <vlan trunk='yes'>, and then can 
specify multiple <tag> subelements for which vlan tags you want to allow.)

If you want a simpler way to have all the guests on a particular switch 
use the same vlan tag, you can define a libvirt network that points to 
the OVS switch, set a vlan tag to be used for all guests connecting to 
that network, then define your guest's interface as <interface 
type='network'>, pointing to this new network definition. Details for 
that can be found at:

http://www.libvirt.org/formatnetwork.html

(search for "openvswitch" and "vlan").

>   or
> libvirt itself to avoid this libvirt's greedines.
>
> libvirt 2.4.0
>
> Thak you.
> Ivan.
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>




More information about the libvirt-users mailing list