1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-27 18:03:50 +03:00

storage: match RNG to supported driver types

At one point, the code passed through arbitrary strings for file
formats, which supposedly lets qemu handle a new file type even
before libvirt has been taught to handle it.  However, to properly
label files, libvirt has to learn the file type anyway, so we
might as well make our life easier by only accepting file types
that we are prepared to handle.  This patch lets the RNG validation
ensure that only known strings are let through.

* docs/schemas/domaincommon.rng (driverFormat): Limit to list of
supported strings.
* docs/schemas/domainsnapshot.rng (driver): Likewise.
This commit is contained in:
Eric Blake 2012-09-28 12:57:54 -06:00
parent 41e0edaf84
commit e2c41e4860
2 changed files with 25 additions and 4 deletions

View File

@ -1188,11 +1188,32 @@
<ref name="genericName"/> <ref name="genericName"/>
</attribute> </attribute>
<optional> <optional>
<attribute name="type"> <attribute name='type'>
<ref name="genericName"/> <choice>
<ref name='diskFormat'/>
<value>aio</value> <!-- back-compat for 'raw' -->
</choice>
</attribute> </attribute>
</optional> </optional>
</define> </define>
<define name='diskFormat'>
<choice>
<value>raw</value>
<value>dir</value>
<value>bochs</value>
<value>cloop</value>
<value>cow</value>
<value>dmg</value>
<value>iso</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
<value>vpc</value>
<value>fat</value>
<value>vhd</value>
</choice>
</define>
<define name="driverCache"> <define name="driverCache">
<attribute name="cache"> <attribute name="cache">
<choice> <choice>
@ -3356,7 +3377,7 @@
</attribute> </attribute>
<optional> <optional>
<attribute name='format'> <attribute name='format'>
<ref name="genericName"/> <ref name='diskFormat'/>
</attribute> </attribute>
</optional> </optional>
<optional> <optional>

View File

@ -105,7 +105,7 @@
<element name='driver'> <element name='driver'>
<optional> <optional>
<attribute name='type'> <attribute name='type'>
<ref name='genericName'/> <ref name='diskFormat'/>
</attribute> </attribute>
</optional> </optional>
<empty/> <empty/>