]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
schema: consolidate RNG for all hostdev <driver> elements
authorLaine Stump <laine@redhat.com>
Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)
committerLaine Stump <laine@redhat.com>
Mon, 8 Jan 2024 04:57:09 +0000 (23:57 -0500)
The exact same element can appear in <hostdev> and <interface
type='hostdev'>, and nearly identical in <network> and <networkport>
(these latter two don't include "xen" as a possible driver, but that's
coincidental - there's no reason Xen couldn't also use the VF pools in
virtual networks, it just doesn't).

This patch modifies all 4 to use the same <ref name="hostdevDriver"/>
so that it is simpler to add something new.

A side effect of this patch is that the grammar for the <interface>
element in domain XML has been tightened up a bit - previously it was
accepted by the schema (but nonsensical) to have virtio and network
interface options specified; as a part of making the two different
<driver> choices each a complete element (rather than each being a
collection of attributes and subelements) these extra
attributes/subelements that were irrelevant to the hostdev-type
<driver> were made to be valid only for an emulated interface's
<driver>.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/schemas/basictypes.rng
src/conf/schemas/domaincommon.rng
src/conf/schemas/network.rng
src/conf/schemas/networkport.rng

index 26eb538077c3eb17e3170b4f5c152780a7f093fd..8d5f4475cac1f2ca53433e0370cd5a3ed06b2a24 100644 (file)
     </choice>
   </define>
 
+  <define name="hostdevDriver">
+    <element name="driver">
+      <attribute name="name">
+        <choice>
+          <value>kvm</value>
+          <value>vfio</value>
+          <value>xen</value>
+        </choice>
+      </attribute>
+      <empty/>
+    </element>
+  </define>
+
 </grammar>
index f318c067976aa1501c528c0c816c7ecd129bf399..c1c267d30378b9af4a7c33c9a0121b40a6fe172b 100644 (file)
         </element>
       </optional>
       <optional>
-        <element name="driver">
-          <choice>
-            <group>
-              <attribute name="name">
-                <choice>
-                  <value>kvm</value>
-                  <value>vfio</value>
-                  <value>xen</value>
-                </choice>
-              </attribute>
-            </group>
-            <group>
+        <choice>
+          <group>
+            <ref name="hostdevDriver"/>
+          </group>
+          <group>
+            <element name="driver">
               <optional>
                 <attribute name="name">
                   <choice>
               <optional>
                 <ref name="event_idx"/>
               </optional>
-            </group>
-          </choice>
-          <ref name="virtioOptions"/>
-          <interleave>
-            <optional>
-              <element name="host">
-                <optional>
-                  <attribute name="csum">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="gso">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="tso4">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="tso6">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="ecn">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="ufo">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-                <optional>
-                  <attribute name="mrg_rxbuf">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
-              </element>
-            </optional>
-            <optional>
-              <element name="guest">
-                <optional>
-                  <attribute name="csum">
-                    <ref name="virOnOff"/>
-                  </attribute>
-                </optional>
+              <ref name="virtioOptions"/>
+              <interleave>
                 <optional>
-                  <attribute name="tso4">
-                    <ref name="virOnOff"/>
-                  </attribute>
+                  <element name="host">
+                    <optional>
+                      <attribute name="csum">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="gso">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="tso4">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="tso6">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="ecn">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="ufo">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="mrg_rxbuf">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                  </element>
                 </optional>
                 <optional>
-                  <attribute name="tso6">
-                    <ref name="virOnOff"/>
-                  </attribute>
+                  <element name="guest">
+                    <optional>
+                      <attribute name="csum">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="tso4">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="tso6">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="ecn">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                    <optional>
+                      <attribute name="ufo">
+                        <ref name="virOnOff"/>
+                      </attribute>
+                    </optional>
+                  </element>
                 </optional>
                 <optional>
-                  <attribute name="ecn">
+                  <attribute name="rss">
                     <ref name="virOnOff"/>
                   </attribute>
                 </optional>
                 <optional>
-                  <attribute name="ufo">
+                  <attribute name="rss_hash_report">
                     <ref name="virOnOff"/>
                   </attribute>
                 </optional>
-              </element>
-            </optional>
-            <optional>
-              <attribute name="rss">
-                <ref name="virOnOff"/>
-              </attribute>
-            </optional>
-            <optional>
-              <attribute name="rss_hash_report">
-                <ref name="virOnOff"/>
-              </attribute>
-            </optional>
-          </interleave>
-        </element>
+              </interleave>
+            </element>
+          </group>
+        </choice>
       </optional>
       <optional>
         <ref name="alias"/>
     </attribute>
     <interleave>
       <optional>
-        <element name="driver">
-          <attribute name="name">
-            <choice>
-              <value>kvm</value>
-              <value>vfio</value>
-              <value>xen</value>
-            </choice>
-          </attribute>
-          <empty/>
-        </element>
+        <ref name="hostdevDriver"/>
       </optional>
       <optional>
         <ref name="teaming"/>
index cda174ab4be224c2a82e1ef109005343cfc3d819..e56e07d13059151a930e6b3dded78e1a05becada 100644 (file)
                 </element>
               </optional>
               <optional>
-                <element name="driver">
-                  <attribute name="name">
-                    <choice>
-                      <value>kvm</value>
-                      <value>vfio</value>
-                    </choice>
-                  </attribute>
-                  <empty/>
-                </element>
+                <ref name="hostdevDriver"/>
               </optional>
               <optional>
                 <element name="nat">
index 14db949578f46bff02d23edae1b4f4a6b204951d..50995559e821432e763096a45d3557275be3b426 100644 (file)
     </optional>
     <interleave>
       <optional>
-        <element name="driver">
-          <attribute name="name">
-            <choice>
-              <value>kvm</value>
-              <value>vfio</value>
-            </choice>
-          </attribute>
-          <empty/>
-        </element>
+        <ref name="hostdevDriver"/>
       </optional>
       <element name="address">
         <ref name="pciaddress"/>