aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaine Stump <laine@laine.org>2012-08-12 03:51:30 -0400
committerLaine Stump <laine@laine.org>2012-08-15 13:10:57 -0400
commit3f9274a524804f8aa59c811932dba56550c120a1 (patch)
tree348bf52bf88261864e7a4bcb1450d62f50d7b5c7 /tests
parentutil: add virNetDevVlanType (diff)
downloadlibvirt-3f9274a524804f8aa59c811932dba56550c120a1.tar.gz
libvirt-3f9274a524804f8aa59c811932dba56550c120a1.tar.bz2
libvirt-3f9274a524804f8aa59c811932dba56550c120a1.zip
conf: add <vlan> element to network and domain interface elements
The following config elements now support a <vlan> subelements: within a domain: <interface>, and the <actual> subelement of <interface> within a network: the toplevel, as well as any <portgroup> Each vlan element must have one or more <tag id='n'/> subelements. If there is more than one tag, it is assumed that vlan trunking is being requested. If trunking is required with only a single tag, the attribute "trunk='yes'" should be added to the toplevel <vlan> element. Some examples: <interface type='hostdev'/> <vlan> <tag id='42'/> </vlan> <mac address='52:54:00:12:34:56'/> ... </interface> <network> <name>vlan-net</name> <vlan trunk='yes'> <tag id='30'/> </vlan> <virtualport type='openvswitch'/> </network> <interface type='network'/> <source network='vlan-net'/> ... </interface> <network> <name>trunk-vlan</name> <vlan> <tag id='42'/> <tag id='43'/> </vlan> ... </network> <network> <name>multi</name> ... <portgroup name='production'/> <vlan> <tag id='42'/> </vlan> </portgroup> <portgroup name='test'/> <vlan> <tag id='666'/> </vlan> </portgroup> </network> <interface type='network'/> <source network='multi' portgroup='test'/> ... </interface> IMPORTANT NOTE: As of this patch there is no backend support for the vlan element for *any* network device type. When support is added in later patches, it will only be for those select network types that support setting up a vlan on the host side, without the guest's involvement. (For example, it will be possible to configure a vlan for a guest connected to an openvswitch bridge, but it won't be possible to do that for one that is connected to a standard Linux host bridge.)
Diffstat (limited to 'tests')
-rw-r--r--tests/networkxml2xmlin/8021Qbh-net.xml3
-rw-r--r--tests/networkxml2xmlin/openvswitch-net.xml8
-rw-r--r--tests/networkxml2xmlout/8021Qbh-net.xml3
-rw-r--r--tests/networkxml2xmlout/openvswitch-net.xml8
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-net-hostdev.xml3
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-net-openvswitch.xml38
-rw-r--r--tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml3
-rw-r--r--tests/qemuxml2xmltest.c1
8 files changed, 67 insertions, 0 deletions
diff --git a/tests/networkxml2xmlin/8021Qbh-net.xml b/tests/networkxml2xmlin/8021Qbh-net.xml
index 2d779dcac..3aaab61db 100644
--- a/tests/networkxml2xmlin/8021Qbh-net.xml
+++ b/tests/networkxml2xmlin/8021Qbh-net.xml
@@ -8,6 +8,9 @@
<interface dev="eth4"/>
<interface dev="eth5"/>
</forward>
+ <vlan>
+ <tag id='549'/>
+ </vlan>
<virtualport type="802.1Qbh">
<parameters profileid="spongebob24"/>
</virtualport>
diff --git a/tests/networkxml2xmlin/openvswitch-net.xml b/tests/networkxml2xmlin/openvswitch-net.xml
index 8aa1897ab..a3d82b165 100644
--- a/tests/networkxml2xmlin/openvswitch-net.xml
+++ b/tests/networkxml2xmlin/openvswitch-net.xml
@@ -4,11 +4,19 @@
<forward mode='bridge'/>
<virtualport type='openvswitch'/>
<portgroup name='bob' default='yes'>
+ <vlan trunk='yes'>
+ <tag id='666'/>
+ </vlan>
<virtualport>
<parameters profileid='bob-profile'/>
</virtualport>
</portgroup>
<portgroup name='alice'>
+ <vlan trunk='yes'>
+ <tag id='777'/>
+ <tag id='888'/>
+ <tag id='999'/>
+ </vlan>
<virtualport>
<parameters profileid='alice-profile'/>
</virtualport>
diff --git a/tests/networkxml2xmlout/8021Qbh-net.xml b/tests/networkxml2xmlout/8021Qbh-net.xml
index d4d5b4b44..281466a9f 100644
--- a/tests/networkxml2xmlout/8021Qbh-net.xml
+++ b/tests/networkxml2xmlout/8021Qbh-net.xml
@@ -8,6 +8,9 @@
<interface dev='eth4'/>
<interface dev='eth5'/>
</forward>
+ <vlan>
+ <tag id='549'/>
+ </vlan>
<virtualport type='802.1Qbh'>
<parameters profileid='spongebob24'/>
</virtualport>
diff --git a/tests/networkxml2xmlout/openvswitch-net.xml b/tests/networkxml2xmlout/openvswitch-net.xml
index 8aa1897ab..a3d82b165 100644
--- a/tests/networkxml2xmlout/openvswitch-net.xml
+++ b/tests/networkxml2xmlout/openvswitch-net.xml
@@ -4,11 +4,19 @@
<forward mode='bridge'/>
<virtualport type='openvswitch'/>
<portgroup name='bob' default='yes'>
+ <vlan trunk='yes'>
+ <tag id='666'/>
+ </vlan>
<virtualport>
<parameters profileid='bob-profile'/>
</virtualport>
</portgroup>
<portgroup name='alice'>
+ <vlan trunk='yes'>
+ <tag id='777'/>
+ <tag id='888'/>
+ <tag id='999'/>
+ </vlan>
<virtualport>
<parameters profileid='alice-profile'/>
</virtualport>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev.xml
index 51b09e914..81f70d0d4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-hostdev.xml
@@ -26,6 +26,9 @@
<source>
<address type='pci' domain='0x0002' bus='0x03' slot='0x07' function='0x1'/>
</source>
+ <vlan>
+ <tag id='42'/>
+ </vlan>
<virtualport type='802.1Qbg'>
<parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
</virtualport>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-openvswitch.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-openvswitch.xml
new file mode 100644
index 000000000..ff098448d
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-openvswitch.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <interface type='network'>
+ <mac address='00:11:22:33:44:55'/>
+ <source network='ovs-net'/>
+ <vlan trunk='yes'>
+ <tag id='42'/>
+ <tag id='48'/>
+ <tag id='456'/>
+ </vlan>
+ <virtualport type='openvswitch'>
+ <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f' profileid='bob'/>
+ </virtualport>
+ </interface>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
index 6d379a044..c84ed3f35 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-network-portgroup.xml
@@ -24,6 +24,9 @@
<interface type='network'>
<mac address='00:11:22:33:44:55'/>
<source network='rednet' portgroup='bob'/>
+ <vlan>
+ <tag id='4095'/>
+ </vlan>
<virtualport type='802.1Qbg'>
<parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
</virtualport>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index dcdba4fc6..da298b7aa 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -178,6 +178,7 @@ mymain(void)
DO_TEST("net-eth-ifname");
DO_TEST("net-virtio-network-portgroup");
DO_TEST("net-hostdev");
+ DO_TEST("net-openvswitch");
DO_TEST("sound");
DO_TEST("sound-device");
DO_TEST("net-bandwidth");