|
| 1 | + How to Use Open vSwitch with Libvirt |
| 2 | + ==================================== |
| 3 | + |
| 4 | +This document describes how to use Open vSwitch with Libvirt 0.9.11 or |
| 5 | +later. The Open vSwitch support in Libvirt 0.9.11 eliminates the need to |
| 6 | +use OVS Linux Bridge compatibility layer (brcompatd) and interface up/down |
| 7 | +scripts. This document assumes that you followed INSTALL.Linux or installed |
| 8 | +Open vSwitch from distribution packaging such as a .deb or .rpm. The Open |
| 9 | +vSwitch support is included by default in Libvirt 0.9.11. Consult |
| 10 | +www.libvirt.org for instructions on how to build the latest Libvirt, if your |
| 11 | +Linux distribution by default comes with an older Libvirt release. |
| 12 | + |
| 13 | +Limitations |
| 14 | +----------- |
| 15 | +Currently there is no Open vSwitch support for networks that are managed |
| 16 | +by libvirt (e.g. NAT). As of now, only bridged networks are supported (those |
| 17 | +where the user has to manually create the bridge). |
| 18 | + |
| 19 | +Setup |
| 20 | +----- |
| 21 | + |
| 22 | +First, create the Open vSwitch bridge by using the ovs-vsctl utility (this |
| 23 | +must be done with administrative privileges): |
| 24 | + |
| 25 | + % ovs-vsctl add-br ovsbr |
| 26 | + |
| 27 | +Once that is done, create a VM, if necessary, and edit its Domain XML file: |
| 28 | + |
| 29 | + % virsh edit <vm> |
| 30 | + |
| 31 | +Lookup in the Domain XML file the <interface> section. There should be one |
| 32 | +such XML section for each interface the VM has. |
| 33 | + |
| 34 | + ... |
| 35 | + <interface type='network'> |
| 36 | + <mac address='52:54:00:71:b1:b6'/> |
| 37 | + <source network='default'/> |
| 38 | + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> |
| 39 | + </interface> |
| 40 | + ... |
| 41 | + |
| 42 | +And change it to something like this: |
| 43 | + |
| 44 | + ... |
| 45 | + <interface type='bridge'> |
| 46 | + <mac address='52:54:00:71:b1:b6'/> |
| 47 | + <source bridge='ovsbr'/> |
| 48 | + <virtualport type='openvswitch'/> |
| 49 | + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> |
| 50 | + </interface> |
| 51 | + ... |
| 52 | + |
| 53 | +The interface type must be set to "bridge". The <source> XML element |
| 54 | +specifies to which bridge this interface will be attached to. The |
| 55 | +<virtualport> element indicates that the bridge in <source> element is an |
| 56 | +Open vSwitch bridge. |
| 57 | + |
| 58 | +Then (re)start the VM and verify if the guest's vnet interface is attached to |
| 59 | +the ovsbr bridge. |
| 60 | + |
| 61 | + % ovs-vsctl show |
| 62 | + |
| 63 | +Troubleshooting |
| 64 | +--------------- |
| 65 | +If the VM does not want to start, then try to run the libvirtd process either |
| 66 | +from the terminal, so that all errors are printed in console, or inspect |
| 67 | +Libvirt/Open vSwitch log files for possible root cause. |
| 68 | + |
| 69 | +Bug Reporting |
| 70 | +------------- |
| 71 | + |
| 72 | +Please report problems to bugs@openvswitch.org. |
0 commit comments