From 3f9274a524804f8aa59c811932dba56550c120a1 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Sun, 12 Aug 2012 03:51:30 -0400 Subject: [PATCH] conf: add element to network and domain interface elements The following config elements now support a subelements: within a domain: , and the subelement of within a network: the toplevel, as well as any Each vlan element must have one or more 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 element. Some examples: ... vlan-net ... trunk-vlan ... multi ... ... 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.) --- docs/formatdomain.html.in | 40 ++++++ docs/formatnetwork.html.in | 50 +++++++ docs/schemas/domaincommon.rng | 3 + docs/schemas/network.rng | 6 + docs/schemas/networkcommon.rng | 20 +++ po/POTFILES.in | 1 + src/Makefile.am | 3 +- src/conf/domain_conf.c | 31 ++++- src/conf/domain_conf.h | 4 + src/conf/netdev_vlan_conf.c | 131 ++++++++++++++++++ src/conf/netdev_vlan_conf.h | 33 +++++ src/conf/network_conf.c | 18 ++- src/conf/network_conf.h | 3 + src/libvirt_private.syms | 6 + tests/networkxml2xmlin/8021Qbh-net.xml | 3 + tests/networkxml2xmlin/openvswitch-net.xml | 8 ++ tests/networkxml2xmlout/8021Qbh-net.xml | 3 + tests/networkxml2xmlout/openvswitch-net.xml | 8 ++ .../qemuxml2argv-net-hostdev.xml | 3 + .../qemuxml2argv-net-openvswitch.xml | 38 +++++ ...uxml2argv-net-virtio-network-portgroup.xml | 3 + tests/qemuxml2xmltest.c | 1 + 22 files changed, 411 insertions(+), 5 deletions(-) create mode 100644 src/conf/netdev_vlan_conf.c create mode 100644 src/conf/netdev_vlan_conf.h create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-openvswitch.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fb25cb8383..2c5c456320 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2857,6 +2857,46 @@ qemu-kvm -net nic,model=? /dev/null Since 0.9.4

+
Setting VLAN tag (on supported network types only)
+ +
+  ...
+  <devices>
+    <interface type='bridge'>
+      <vlan>
+        <tag id='42'/>
+      </vlan>
+      <source bridge='ovsbr0'/>
+      <virtualport type='openvswitch'>
+        <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+    </interface>
+  <devices>
+  ...
+ +

+ If (and only if) the network connection used by the guest + supports vlan tagging transparent to the guest, an + optional <vlan> element can specify one or + more vlan tags to apply to the guest's network + traffic Since 0.10.0. (openvswitch + and type='hostdev' SR-IOV interfaces do support transparent vlan + tagging of guest traffic; everything else, including standard + linux bridges and libvirt's own virtual networks, do not + support it. 802.1Qbh (vn-link) and 802.1Qbg (VEPA) switches + provide their own way (outside of libvirt) to tag guest traffic + onto specific vlans.) To allow for specification of multiple + tags (in the case of vlan trunking), a + subelement, <tag%gt;, specifies which vlan tag + to use (for example: <tag id='42'/>. If an + interface has more than one <vlan> element + defined, it is assumed that the user wants to do VLAN trunking + using all the specified tags. In the case that vlan trunking + with a single tag is desired, the optional + attribute trunk='yes' can be added to the toplevel + vlan element. +

+
Modifying virtual link state
   ...
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index a010cbd217..ed9f7a9db1 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -306,6 +306,56 @@
         Since 0.9.4
       

+
Setting VLAN tag (on supported network types only)
+ +
+  ...
+  <devices>
+    <interface type='bridge'>
+      <vlan trunk='yes'>
+        <tag id='42'/>
+        <tag id='47'/>
+      </vlan>
+      <source bridge='ovsbr0'/>
+      <virtualport type='openvswitch'>
+        <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+    </interface>
+  <devices>
+  ...
+ +

+ If (and only if) the network type supports vlan tagging + transparent to the guest, an optional <vlan> + element can specify one or more vlan tags to apply to the + traffic of all guests using this + network Since 0.10.0. (openvswitch + and type='hostdev' SR-IOV networks do support transparent vlan + tagging of guest traffic; everything else, including standard + linux bridges and libvirt's own virtual networks, do not + support it. 802.1Qbh (vn-link) and 802.1Qbg (VEPA) switches + provide their own way (outside of libvirt) to tag guest traffic + onto specific vlans.) As expected, the tag + attribute specifies which vlan tag to use. If a network has more + than one <vlan> element defined, it is + assumed that the user wants to do VLAN trunking using all the + specified tags. In the case that vlan trunking with a single tag + is desired, the optional attribute trunk='yes' can + be added to the vlan element. +

+

+ <vlan> elements can also be specified in + a <portgroup> element, as well as directly in + a domain's <interface> element. In the case + that a vlan tag is specified in multiple locations, the setting + in <interface> takes precedence, followed by + the setting in the <portgroup> selected by + the interface config. The <vlan> + in <network> will be selected only if none is + given in <portgroup> + or <interface>. +

+
Portgroups
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 767fccda08..4903ca69e3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1713,6 +1713,9 @@
       
         
       
+      
+        
+