[libvirt] [PATCH 06/10] network: RNG changes for virtual switch

Laine Stump laine at laine.org
Tue Jul 5 07:45:54 UTC 2011


This adds <virtualportprofile> and <portgroup> (which itself can
contain a <portgroup>) to <network>, adds several new options to
forward mode, and adds an optional pool of interfaces to <forward>.

Since virtualPortProfile is now used in both the domain and network
RNG, its definition was moved into a separate file that is included by
both.
---
 docs/schemas/Makefile.am       |    1 +
 docs/schemas/domain.rng        |   54 ++++++---------------------------------
 docs/schemas/network.rng       |   29 +++++++++++++++++++++
 docs/schemas/networkcommon.rng |   50 +++++++++++++++++++++++++++++++++++++
 libvirt.spec.in                |    1 +
 5 files changed, 90 insertions(+), 45 deletions(-)
 create mode 100644 docs/schemas/networkcommon.rng

diff --git a/docs/schemas/Makefile.am b/docs/schemas/Makefile.am
index 5ef7737..75a0e73 100644
--- a/docs/schemas/Makefile.am
+++ b/docs/schemas/Makefile.am
@@ -8,6 +8,7 @@ schema_DATA = \
 	domainsnapshot.rng \
 	interface.rng \
 	network.rng \
+	networkcommon.rng \
 	nodedev.rng \
 	nwfilter.rng \
 	secret.rng \
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 3c8414e..65572df 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -7,7 +7,7 @@
 
   <include href='basictypes.rng'/>
   <include href='storageencryption.rng'/>
-
+  <include href='networkcommon.rng'/>
   <!--
     description element, maybe placed anywhere under the root
     -->
@@ -1022,6 +1022,14 @@
               </attribute>
               <empty/>
             </element>
+            <optional>
+              <attribute name="portgroup">
+                <ref name="deviceName"/>
+              </attribute>
+            </optional>
+            <optional>
+              <ref name="virtualPortProfile"/>
+            </optional>
             <ref name="interface-options"/>
           </interleave>
         </group>
@@ -1167,45 +1175,6 @@
       </optional>
     </interleave>
   </define>
-  <define name="virtualPortProfile">
-    <choice>
-      <group>
-        <element name="virtualport">
-          <attribute name="type">
-            <value>802.1Qbg</value>
-          </attribute>
-          <element name="parameters">
-            <attribute name="managerid">
-              <ref name="uint8range"/>
-            </attribute>
-            <attribute name="typeid">
-              <ref name="uint24range"/>
-            </attribute>
-            <attribute name="typeidversion">
-              <ref name="uint8range"/>
-            </attribute>
-            <optional>
-              <attribute name="instanceid">
-                <ref name="UUID"/>
-              </attribute>
-            </optional>
-          </element>
-        </element>
-      </group>
-      <group>
-        <element name="virtualport">
-          <attribute name="type">
-            <value>802.1Qbh</value>
-          </attribute>
-          <element name="parameters">
-            <attribute name="profileid">
-              <ref name="virtualPortProfileID"/>
-            </attribute>
-          </element>
-        </element>
-      </group>
-    </choice>
-  </define>
   <!--
       An emulator description is just a path to the binary used for the task
     -->
@@ -2483,9 +2452,4 @@
       <param name="pattern">[a-zA-Z0-9_\.:]+</param>
     </data>
   </define>
-  <define name="virtualPortProfileID">
-    <data type="string">
-      <param name="maxLength">39</param>
-    </data>
-  </define>
 </grammar>
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 6d9f06b..9e667e6 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -7,6 +7,7 @@
   </start>
 
   <include href='basictypes.rng'/>
+  <include href='networkcommon.rng'/>
 
   <define name="network">
 
@@ -77,9 +78,37 @@
                 <choice>
                   <value>nat</value>
                   <value>route</value>
+                  <value>bridge</value>
+                  <value>passthrough</value>
+                  <value>private</value>
+                  <value>vepa</value>
                 </choice>
               </attribute>
             </optional>
+            <zeroOrMore>
+              <element name='interface'>
+                <attribute name='dev'>
+                  <ref name='deviceName'/>
+                </attribute>
+              </element>
+            </zeroOrMore>
+          </element>
+        </optional>
+
+        <!-- <virtualport> element -->
+        <optional>
+          <ref name="virtualPortProfile"/>
+        </optional>
+
+        <!-- <portgroup> elements -->
+        <optional>
+          <element name='portgroup'>
+            <attribute name='engineering'>
+              <ref name='deviceName'/>
+            </attribute>
+            <optional>
+              <ref name="virtualPortProfile"/>
+            </optional>
           </element>
         </optional>
 
diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng
new file mode 100644
index 0000000..0251813
--- /dev/null
+++ b/docs/schemas/networkcommon.rng
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!-- network-related definitions used in multiple grammars -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+  <define name="virtualPortProfileID">
+    <data type="string">
+      <param name="maxLength">39</param>
+    </data>
+  </define>
+
+  <define name="virtualPortProfile">
+    <choice>
+      <group>
+        <element name="virtualport">
+          <attribute name="type">
+            <value>802.1Qbg</value>
+          </attribute>
+          <element name="parameters">
+            <attribute name="managerid">
+              <ref name="uint8range"/>
+            </attribute>
+            <attribute name="typeid">
+              <ref name="uint24range"/>
+            </attribute>
+            <attribute name="typeidversion">
+              <ref name="uint8range"/>
+            </attribute>
+            <optional>
+              <attribute name="instanceid">
+                <ref name="UUID"/>
+              </attribute>
+            </optional>
+          </element>
+        </element>
+      </group>
+      <group>
+        <element name="virtualport">
+          <attribute name="type">
+            <value>802.1Qbh</value>
+          </attribute>
+          <element name="parameters">
+            <attribute name="profileid">
+              <ref name="virtualPortProfileID"/>
+            </attribute>
+          </element>
+        </element>
+      </group>
+    </choice>
+  </define>
+</grammar>
diff --git a/libvirt.spec.in b/libvirt.spec.in
index bf220f3..8c059f8 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1066,6 +1066,7 @@ fi
 %{_datadir}/libvirt/schemas/storageencryption.rng
 %{_datadir}/libvirt/schemas/nwfilter.rng
 %{_datadir}/libvirt/schemas/basictypes.rng
+%{_datadir}/libvirt/schemas/networkcommon.rng
 
 %{_datadir}/libvirt/cpu_map.xml
 
-- 
1.7.3.4




More information about the libvir-list mailing list