mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 15:00:07 +00:00
369cdfa8f5
This patch is my first experience playing with nested grammars, as documented in http://relaxng.org/tutorial-20011203.html#IDA3PZR. I plan on doing more overrides in order to make the RelaxNG grammar mirror the C code refactoring into a common virStorageSource, but where different clients of that source do not support the same subset of functionality. By starting with something fairly easy to validate, I can make sure my later patches will be possible. This patch adds a use of the no-op <ref name='sourceStartupPolicy'/> to the disksnapshot definition, so that the snapshot version of a type='file' <source> more closely resembles the version in domaincommon. A future patch will merge the two files into using a common define, but this patch is sufficient for testing that adding <source startupPolicy='optional'/> in any of the tests/domainsnapshotxml2xmlin/*.xml files still gets rejected unless it occurs within the <domain> subelement, because the definition of startupPolicy is empty outside of domain.rng. * docs/schemas/storagecommon.rng (storageStartupPolicy) (storageSourceExtra): Create no-op defaults. * docs/schemas/domainsnapshot.rng (domain): Use nested grammar to avoid restricting <domain>. (storageSourceExtra): Create new override. (disksnapshot): Access overrides through common names. * docs/schemas/domaincommon.rng (disk): Access overrides through common names. * docs/schemas/domain.rng (storageStartupPolicy) (storageSourceExtra): Create new overrides. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
97 lines
2.5 KiB
XML
97 lines
2.5 KiB
XML
<?xml version="1.0"?>
|
|
<!-- A Relax NG schema for common libvirt XML storage elements -->
|
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
|
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
|
|
<!-- This schema is not designed for standalone use; another file
|
|
must include both this file and basictypes.rng -->
|
|
|
|
<define name='encryption'>
|
|
<element name='encryption'>
|
|
<attribute name='format'>
|
|
<choice>
|
|
<value>default</value>
|
|
<value>qcow</value>
|
|
</choice>
|
|
</attribute>
|
|
<zeroOrMore>
|
|
<ref name='secret'/>
|
|
</zeroOrMore>
|
|
</element>
|
|
</define>
|
|
|
|
<define name='secret'>
|
|
<element name='secret'>
|
|
<attribute name='type'>
|
|
<choice>
|
|
<value>passphrase</value>
|
|
</choice>
|
|
</attribute>
|
|
<attribute name='uuid'>
|
|
<ref name="UUID"/>
|
|
</attribute>
|
|
</element>
|
|
</define>
|
|
|
|
<define name='compat'>
|
|
<element name='compat'>
|
|
<data type='string'>
|
|
<param name='pattern'>[0-9]+\.[0-9]+</param>
|
|
</data>
|
|
</element>
|
|
</define>
|
|
<define name='fileFormatFeatures'>
|
|
<element name='features'>
|
|
<interleave>
|
|
<optional>
|
|
<element name='lazy_refcounts'>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
</interleave>
|
|
</element>
|
|
</define>
|
|
|
|
<!-- split the list of known storage formats into two, those where
|
|
we know how to follow backing chains, and all others -->
|
|
<define name='storageFormatBacking'>
|
|
<choice>
|
|
<value>cow</value>
|
|
<value>qcow</value>
|
|
<value>qcow2</value>
|
|
<value>qed</value>
|
|
<value>vmdk</value>
|
|
</choice>
|
|
</define>
|
|
<define name='storageFormat'>
|
|
<choice>
|
|
<value>raw</value>
|
|
<value>dir</value>
|
|
<value>bochs</value>
|
|
<value>cloop</value>
|
|
<value>dmg</value>
|
|
<value>iso</value>
|
|
<value>vpc</value>
|
|
<value>vdi</value>
|
|
<value>fat</value>
|
|
<value>vhd</value>
|
|
<ref name='storageFormatBacking'/>
|
|
</choice>
|
|
</define>
|
|
|
|
<define name='storageStartupPolicy'>
|
|
<!-- Use a combine='choice' override in client files that want to
|
|
add additional attributes to a <source> sub-element
|
|
associated with a storage source -->
|
|
<notAllowed/>
|
|
</define>
|
|
|
|
<define name='storageSourceExtra'>
|
|
<!-- Use a combine='choice' override in client files that want to
|
|
add additional elements as siblings of a <source> sub-element
|
|
associated with a storage source -->
|
|
<notAllowed/>
|
|
</define>
|
|
|
|
</grammar>
|