[PATCH 2/3] interface: allow multiple IPv4 addresses + dhcp on a single interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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                         | 28 ++++++++++------------
 .../ethernet-dhcp-and-multi-static.xml             |  9 +++++++
 tests/interfacexml2xmltest.c                       |  1 +
 3 files changed, 23 insertions(+), 15 deletions(-)
 create mode 100644 tests/interfaceschemadata/ethernet-dhcp-and-multi-static.xml

diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng
index 45b40cd..052703c 100644
--- a/docs/schemas/interface.rng
+++ b/docs/schemas/interface.rng
@@ -323,24 +323,22 @@
         <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
index 0000000..3bef2b6
--- /dev/null
+++ b/tests/interfaceschemadata/ethernet-dhcp-and-multi-static.xml
@@ -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>
diff --git a/tests/interfacexml2xmltest.c b/tests/interfacexml2xmltest.c
index 5e11754..65f5167 100644
--- a/tests/interfacexml2xmltest.c
+++ b/tests/interfacexml2xmltest.c
@@ -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");
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]