]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
interface: allow multiple IPv4 addresses + dhcp on a single interface
authorLaine Stump <laine@laine.org>
Thu, 21 May 2015 15:26:52 +0000 (11:26 -0400)
committerLaine Stump <laine@laine.org>
Fri, 22 May 2015 14:14:01 +0000 (10:14 -0400)
As of netcf-0.2.8, netcf supports configuring multipl IPv4 addresses,
as well as simultaneously configuring dhcp and static IPv4 addresses,
on a single interface. This patch updates libvirt's interface.rng to
allow such configurations.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1223688

docs/schemas/interface.rng
tests/interfaceschemadata/ethernet-dhcp-and-multi-static.xml [new file with mode: 0644]
tests/interfacexml2xmltest.c

index 45b40cd8fa7b44ddb04171783ec8463ff20a00a3..052703ce84aae8a09a8a1ac279505115d863b281 100644 (file)
         <value>ipv4</value>
       </attribute>
       <interleave>
-        <choice>
+        <optional>
           <ref name="dhcp-element"/>
-          <group>
-            <oneOrMore>
-              <element name="ip">
-                <attribute name="address"><ref name="ipv4Addr"/></attribute>
-                <optional>
-                  <attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
-                </optional>
-              </element>
-            </oneOrMore>
+        </optional>
+        <zeroOrMore>
+          <element name="ip">
+            <attribute name="address"><ref name="ipv4Addr"/></attribute>
             <optional>
-              <element name="route">
-                <attribute name="gateway"><ref name="ipv4Addr"/></attribute>
-              </element>
+              <attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
             </optional>
-          </group>
-        </choice>
+          </element>
+        </zeroOrMore>
+        <optional>
+          <element name="route">
+            <attribute name="gateway"><ref name="ipv4Addr"/></attribute>
+          </element>
+        </optional>
       </interleave>
     </element>
   </define>
diff --git a/tests/interfaceschemadata/ethernet-dhcp-and-multi-static.xml b/tests/interfaceschemadata/ethernet-dhcp-and-multi-static.xml
new file mode 100644 (file)
index 0000000..3bef2b6
--- /dev/null
@@ -0,0 +1,9 @@
+<interface type='ethernet' name='eth1'>
+  <start mode='onboot'/>
+  <protocol family='ipv4'>
+    <dhcp peerdns='yes'/>
+    <ip address='192.168.0.5' prefix='24'/>
+    <ip address='1.2.3.4' prefix='32'/>
+    <route gateway='192.168.0.1'/>
+  </protocol>
+</interface>
index 5e11754575d4ce5dc863da59e9023e39d1b3611f..65f516788ccb4c294ddd743c9c95397975b8acbf 100644 (file)
@@ -75,6 +75,7 @@ mymain(void)
         ret = -1
 
     DO_TEST("ethernet-dhcp");
+    DO_TEST("ethernet-dhcp-and-multi-static");
     DO_TEST("ethernet-static");
     DO_TEST("ethernet-static-no-prefix");
     DO_TEST("bridge");