Open vSwitch 与 Libvirt

This document describes how to use the Open vSwitch together with Libvirt version 0.9.11 or higher. This document assumes that you follow the documentation: /intro/install/generalor from the distribution package (such as .deb or .rpm) installed Open vSwitch. Libvirt 0.9.11 default version adds support for the Open vSwitch. Consulting www.libvirt.org for instructions on how to compile the update Libvirt, if at default, Linux distributions comes with an older version of libvirt.

limit

Open vSwitch is currently not supported by the libvirt: a network (such as NAT) management. So far, only supports a bridged network (those users must manually create the bridge).

set up

First, create a bridge using Open vSwitch ovs-vsctl tool (which must be done with administrative permissions):

$ ovs-vsctl add-br ovsbr

Upon completion, if necessary, create a VM, and edit its Domain XML file:

$ virsh edit <vm>

Find Domain XML file <interface>section. For each interface having a virtual machine, by a portion corresponding to this XML:

<interface type='network'>
 <mac address='52:54:00:71:b1:b6'/>
 <source network='default'/>
 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

Change it to this:

<interface type='bridge'>
 <mac address='52:54:00:71:b1:b6'/>
 <source bridge='ovsbr'/>
 <virtualport type='openvswitch'/>
 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

Interface type must be set bridge. XML element <source>to specify which this interface is added to the bridge. <virtualport>Elements represent <source>elements of the bridge is a bridge Open vSwitch.

Then (re) start the virtual machine and verify the client's vnet interface is connected to the ovsbrbridge:

$ ovs-vsctl show

Troubleshooting

If the VM can not start, try to run on the terminal libvirtd process in order to print all error messages in the console, or check Libvirt / Open vSwitch log files to find the possible root causes.

Guess you like

Origin blog.csdn.net/sinat_20184565/article/details/94590369