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