[netcf-devel] [PATCH 2/2] permit link state in XML schema for bonds and vlans too

Laine Stump laine at laine.org
Thu Aug 21 22:27:25 UTC 2014


When support for reporting link state and speed in interface status
was added to netcf in commit 4be980b4, the changes to the RNG file
(XML schema) were taken from libvirt, but at that point libvirt's RNG
did not document reporting link state/speed for vlan or bond
interfaces, so the schema in netcf also only shows the presence of the
<link> element for ethernet interfaces (although in practice it does
actually report <link> for those types of interfaces).

This patch updates the RNG in netcf to match what is allowed by the
RNG in libvirt (since being corrected in libvirt commit
69db5f92). This makes no functional difference, since netcf's RNG is
only referenced when an interface is defined (but <link> is a
read-only element, so would never appear in the definition for a new
interface), but it's always a good idea for the schema to be correct.

libirt upstream commit 69db5f921a2f6d62645f3531042b13b6382eb865
---
 data/xml/interface.rng | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/data/xml/interface.rng b/data/xml/interface.rng
index f22910f..7810a7a 100644
--- a/data/xml/interface.rng
+++ b/data/xml/interface.rng
@@ -40,17 +40,8 @@
           <attribute name="address"><ref name="mac-addr"/></attribute>
         </element>
       </optional>
-      <optional>
-        <element name="link">
-          <optional>
-            <attribute name="speed"><ref name="uint"/></attribute>
-          </optional>
-          <optional>
-            <attribute name="state"><ref name="link-state"/></attribute>
-          </optional>
-        </element>
-        <empty/>
-      </optional>
+      <ref name="link-speed-state"/>
+      <empty/>
       <!-- FIXME: Allow (some) ethtool options -->
     </interleave>
   </define>
@@ -86,6 +77,7 @@
          of the form DEVICE.VLAN
     -->
     <optional><ref name="name-attr"/></optional>
+    <ref name="link-speed-state"/>
   </define>
 
   <define name="vlan-device">
@@ -164,6 +156,7 @@
       <value>bond</value>
     </attribute>
     <ref name="name-attr"/>
+    <ref name="link-speed-state"/>
   </define>
 
   <define name="bond-element">
@@ -485,6 +478,21 @@
     </choice>
   </define>
 
+  <define name="link-speed-state">
+    <optional>
+      <element name="link">
+        <optional>
+          <attribute name="speed">
+            <ref name="uint"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="state"><ref name="link-state"/></attribute>
+        </optional>
+      </element>
+    </optional>
+  </define>
+
   <define name='ipv4-addr'>
     <data type='string'>
       <param name="pattern">(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))</param>
-- 
1.9.3



More information about the netcf-devel mailing list