[libvirt] [PATCH v2 2/5] schema: Let elements in /network/ip be specified in any order

Jiri Denemark jdenemar at redhat.com
Tue Dec 13 13:52:46 UTC 2016


Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 docs/schemas/network.rng                        | 80 +++++++++++++------------
 tests/networkxml2confdata/dhcp6-nat-network.xml |  2 +-
 tests/networkxml2confdata/netboot-network.xml   |  2 +-
 3 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 9d8c803ff..986119596 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -339,48 +339,52 @@
             <optional>
               <attribute name="family"><ref name="addr-family"/></attribute>
             </optional>
-            <optional>
-              <element name="tftp">
-                <attribute name="root"><text/></attribute>
-              </element>
-            </optional>
-            <optional>
-              <!-- Define the range(s) of IP addresses that the DHCP
-                   server should hand out -->
-              <element name="dhcp">
-                <zeroOrMore>
-                  <element name="range">
-                    <attribute name="start"><ref name="ipAddr"/></attribute>
-                    <attribute name="end"><ref name="ipAddr"/></attribute>
-                  </element>
-                </zeroOrMore>
-                <zeroOrMore>
-                  <element name="host">
-                    <choice>
-                      <group>
+            <interleave>
+              <optional>
+                <element name="tftp">
+                  <attribute name="root"><text/></attribute>
+                </element>
+              </optional>
+              <optional>
+                <!-- Define the range(s) of IP addresses that the DHCP
+                     server should hand out -->
+                <element name="dhcp">
+                  <interleave>
+                    <zeroOrMore>
+                      <element name="range">
+                        <attribute name="start"><ref name="ipAddr"/></attribute>
+                        <attribute name="end"><ref name="ipAddr"/></attribute>
+                      </element>
+                    </zeroOrMore>
+                    <zeroOrMore>
+                      <element name="host">
                         <choice>
-                          <attribute name="mac"><ref name="uniMacAddr"/></attribute>
-                          <attribute name="id"><ref name="DUID"/></attribute>
-                        </choice>
-                        <optional>
+                          <group>
+                            <choice>
+                              <attribute name="mac"><ref name="uniMacAddr"/></attribute>
+                              <attribute name="id"><ref name="DUID"/></attribute>
+                            </choice>
+                            <optional>
+                              <attribute name="name"><text/></attribute>
+                            </optional>
+                          </group>
                           <attribute name="name"><text/></attribute>
-                        </optional>
-                      </group>
-                      <attribute name="name"><text/></attribute>
-                    </choice>
-                    <attribute name="ip"><ref name="ipAddr"/></attribute>
-                  </element>
-                </zeroOrMore>
-                <optional>
-                  <element name="bootp">
-                    <attribute name="file"><ref name="filePath"/></attribute>
+                        </choice>
+                        <attribute name="ip"><ref name="ipAddr"/></attribute>
+                      </element>
+                    </zeroOrMore>
                     <optional>
-                      <attribute name="server"><ref name="dnsName"/></attribute>
+                      <element name="bootp">
+                        <attribute name="file"><ref name="filePath"/></attribute>
+                        <optional>
+                          <attribute name="server"><ref name="dnsName"/></attribute>
+                        </optional>
+                      </element>
                     </optional>
-                  </element>
-                </optional>
-              </element>
-            </optional>
+                  </interleave>
+                </element>
+              </optional>
+            </interleave>
           </element>
         </zeroOrMore>
         <!-- <route> element -->
diff --git a/tests/networkxml2confdata/dhcp6-nat-network.xml b/tests/networkxml2confdata/dhcp6-nat-network.xml
index a67bde8f3..cab0700f2 100644
--- a/tests/networkxml2confdata/dhcp6-nat-network.xml
+++ b/tests/networkxml2confdata/dhcp6-nat-network.xml
@@ -5,9 +5,9 @@
   <bridge name='virbr0' stp='on' delay='0'/>
   <ip address='192.168.122.1' netmask='255.255.255.0'>
     <dhcp>
-      <range start='192.168.122.2' end='192.168.122.254'/>
       <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10'/>
       <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11'/>
+      <range start='192.168.122.2' end='192.168.122.254'/>
     </dhcp>
   </ip>
   <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'>
diff --git a/tests/networkxml2confdata/netboot-network.xml b/tests/networkxml2confdata/netboot-network.xml
index 8d5ad31a0..ec06c3005 100644
--- a/tests/networkxml2confdata/netboot-network.xml
+++ b/tests/networkxml2confdata/netboot-network.xml
@@ -5,10 +5,10 @@
   <bridge name='virbr1' stp='off' delay='1'/>
   <domain name='example.com'/>
   <ip address='192.168.122.1' netmask='255.255.255.0'>
-    <tftp root='/var/lib/tftproot'/>
     <dhcp>
       <range start='192.168.122.2' end='192.168.122.254'/>
       <bootp file='pxeboot.img'/>
     </dhcp>
+    <tftp root='/var/lib/tftproot'/>
   </ip>
 </network>
-- 
2.11.0




More information about the libvir-list mailing list