schema: consolidate RNG for all hostdev <driver> elements

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>
This commit is contained in:
Laine Stump 2024-01-04 20:12:51 -05:00
parent 568efef729
commit deefaf8f1c
4 changed files with 98 additions and 116 deletions

View File

@ -656,4 +656,17 @@
</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>

View File

@ -3762,18 +3762,12 @@
</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>
@ -3811,90 +3805,90 @@
<optional>
<ref name="event_idx"/>
</optional>
</group>
</choice>
<ref name="virtioOptions"/>
<interleave>
<optional>
<element name="host">
<ref name="virtioOptions"/>
<interleave>
<optional>
<attribute name="csum">
<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>
<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="rss">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="gso">
<attribute name="rss_hash_report">
<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>
<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="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"/>
@ -6227,16 +6221,7 @@
</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"/>

View File

@ -179,15 +179,7 @@
</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">

View File

@ -145,15 +145,7 @@
</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"/>