mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
xml: share 'unit' in RNG
The code supported unit='E' for "exabyte", but the RNG did not; conversely, the RNG supported "z" and "y" but the code did not (I'm jealous if you have that much storage, particularly since it won't fit in 64-bit off_t). Also, the code supported <allocation unit='...'>, but not the RNG. In an effort to make 'unit' more worthwhile in future patches, it's easier to share it between files. In making this factorization, note that absFilePath is more permissive than 'path', so storage pools and storage volumes will now validate with a wider set of file names than before. I don't think this should be a problem in practice. * docs/schemas/storagepool.rng: Include basic types, rather than repeating things here. * docs/schemas/storagevol.rng: Likewise. * docs/schemas/basictypes.rng: Add 'unsignedLong', 'unit', and fix to match storage code.
This commit is contained in:
parent
0d90823e87
commit
cb7583e161
@ -8,6 +8,11 @@
|
||||
<param name="pattern">[0-9]+</param>
|
||||
</data>
|
||||
</define>
|
||||
<define name='unsignedLong'>
|
||||
<data type='unsignedLong'>
|
||||
<param name='pattern'>[0-9]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="positiveInteger">
|
||||
<data type="positiveInteger">
|
||||
@ -133,4 +138,10 @@
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='unit'>
|
||||
<data type='string'>
|
||||
<param name='pattern'>[kKmMgGtTpPeE]</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
</grammar>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<!-- A Relax NG schema for the libvirt storage pool XML format -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<include href='basictypes.rng'/>
|
||||
<start>
|
||||
<ref name='pool'/>
|
||||
</start>
|
||||
@ -127,7 +128,7 @@
|
||||
</element>
|
||||
<optional>
|
||||
<element name='uuid'>
|
||||
<ref name='uuid'/>
|
||||
<ref name='UUID'/>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
@ -135,17 +136,17 @@
|
||||
<define name='sizing'>
|
||||
<optional>
|
||||
<element name='capacity'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='allocation'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='available'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
@ -154,13 +155,13 @@
|
||||
<optional>
|
||||
<element name='permissions'>
|
||||
<element name='mode'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<element name='owner'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<element name='group'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
@ -175,7 +176,7 @@
|
||||
<element name='target'>
|
||||
<optional>
|
||||
<element name='path'>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name='permissions'/>
|
||||
@ -200,7 +201,7 @@
|
||||
<element name='device'>
|
||||
<attribute name='path'>
|
||||
<choice>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
<ref name='name'/>
|
||||
</choice>
|
||||
</attribute>
|
||||
@ -226,10 +227,10 @@
|
||||
<oneOrMore>
|
||||
<element name='freeExtent'>
|
||||
<attribute name='start'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</attribute>
|
||||
<attribute name='end'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</attribute>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
@ -238,7 +239,7 @@
|
||||
<define name='sourceinfodir'>
|
||||
<element name='dir'>
|
||||
<attribute name='path'>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
</attribute>
|
||||
<empty/>
|
||||
</element>
|
||||
@ -454,28 +455,6 @@
|
||||
<param name="pattern">[a-zA-Z0-9_\+\-]+</param>
|
||||
</data>
|
||||
</define>
|
||||
<define name='uuid'>
|
||||
<choice>
|
||||
<data type='string'>
|
||||
<param name="pattern">[a-fA-F0-9]{32}</param>
|
||||
</data>
|
||||
<data type='string'>
|
||||
<param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
|
||||
</data>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name='uint'>
|
||||
<data type='string'>
|
||||
<param name="pattern">[0-9]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='path'>
|
||||
<data type='string'>
|
||||
<param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="PortNumber">
|
||||
<data type="short">
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- A Relax NG schema for the libvirt storage volume XML format -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<include href='basictypes.rng'/>
|
||||
<start>
|
||||
<ref name='vol'/>
|
||||
</start>
|
||||
@ -35,12 +37,17 @@
|
||||
<ref name='unit'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='allocation'>
|
||||
<ref name='uint'/>
|
||||
<optional>
|
||||
<attribute name='unit'>
|
||||
<ref name='unit'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
@ -49,13 +56,13 @@
|
||||
<optional>
|
||||
<element name='permissions'>
|
||||
<element name='mode'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<element name='owner'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<element name='group'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
@ -70,7 +77,7 @@
|
||||
<element name='target'>
|
||||
<optional>
|
||||
<element name='path'>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name='format'/>
|
||||
@ -84,7 +91,7 @@
|
||||
<define name='backingStore'>
|
||||
<element name='backingStore'>
|
||||
<element name='path'>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
</element>
|
||||
<ref name='format'/>
|
||||
<ref name='permissions'/>
|
||||
@ -103,7 +110,7 @@
|
||||
<define name='sourcedev'>
|
||||
<element name='device'>
|
||||
<attribute name='path'>
|
||||
<ref name='path'/>
|
||||
<ref name='absFilePath'/>
|
||||
</attribute>
|
||||
<choice>
|
||||
<empty/>
|
||||
@ -116,10 +123,10 @@
|
||||
<oneOrMore>
|
||||
<element name='extent'>
|
||||
<attribute name='start'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</attribute>
|
||||
<attribute name='end'>
|
||||
<ref name='uint'/>
|
||||
<ref name='unsignedLong'/>
|
||||
</attribute>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
@ -180,33 +187,4 @@
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='uint'>
|
||||
<data type='string'>
|
||||
<param name="pattern">[0-9]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='path'>
|
||||
<data type='string'>
|
||||
<param name="pattern">/[a-zA-Z0-9_\+\-\./%]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='unit'>
|
||||
<data type='string'>
|
||||
<param name="pattern">[kKmMgGtTpPyYzZ]</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="UUID">
|
||||
<choice>
|
||||
<data type="string">
|
||||
<param name="pattern">[a-fA-F0-9]{32}</param>
|
||||
</data>
|
||||
<data type="string">
|
||||
<param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
|
||||
</data>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
</grammar>
|
||||
|
Loading…
Reference in New Issue
Block a user