提交 f5580bd6 编写于 作者: E Eric Blake

storage: allow interleave in volume XML

The RNG grammar did not allow arbitrary interleaving, which makes
it harder than necessary to create a new volume from handwritten XML.
(Compare also to commit caf516db for pools).

* docs/schemas/storagevol.rng: Support interleaving.
* tests/storagevolxml2xmlin/vol-file-backing.xml: Test it.
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 d68f1644
...@@ -13,55 +13,61 @@ ...@@ -13,55 +13,61 @@
<define name='vol'> <define name='vol'>
<element name='volume'> <element name='volume'>
<element name='name'> <interleave>
<ref name='volName'/> <element name='name'>
</element> <ref name='volName'/>
<optional>
<element name='key'>
<text/>
</element> </element>
</optional> <optional>
<optional> <element name='key'>
<ref name='source'/> <text/>
</optional> </element>
<ref name='sizing'/> </optional>
<ref name='target'/> <optional>
<optional> <ref name='source'/>
<ref name='backingStore'/> </optional>
</optional> <ref name='sizing'/>
<ref name='target'/>
<optional>
<ref name='backingStore'/>
</optional>
</interleave>
</element> </element>
</define> </define>
<define name='sizing'> <define name='sizing'>
<optional> <interleave>
<element name='capacity'> <optional>
<ref name='scaledInteger'/> <element name='capacity'>
</element> <ref name='scaledInteger'/>
</optional> </element>
<optional> </optional>
<element name='allocation'> <optional>
<ref name='scaledInteger'/> <element name='allocation'>
</element> <ref name='scaledInteger'/>
</optional> </element>
</optional>
</interleave>
</define> </define>
<define name='permissions'> <define name='permissions'>
<optional> <optional>
<element name='permissions'> <element name='permissions'>
<element name='mode'> <interleave>
<ref name='octalMode'/> <element name='mode'>
</element> <ref name='octalMode'/>
<element name='owner'> </element>
<ref name='unsignedInt'/> <element name='owner'>
</element> <ref name='unsignedInt'/>
<element name='group'> </element>
<ref name='unsignedInt'/> <element name='group'>
</element> <ref name='unsignedInt'/>
<optional> </element>
<element name='label'> <optional>
<text/> <element name='label'>
</element> <text/>
</optional> </element>
</optional>
</interleave>
</element> </element>
</optional> </optional>
</define> </define>
...@@ -103,36 +109,40 @@ ...@@ -103,36 +109,40 @@
<define name='target'> <define name='target'>
<element name='target'> <element name='target'>
<optional> <interleave>
<element name='path'> <optional>
<choice> <element name='path'>
<data type='anyURI'/> <choice>
<ref name='absFilePath'/> <data type='anyURI'/>
</choice> <ref name='absFilePath'/>
</element> </choice>
</optional> </element>
<ref name='format'/> </optional>
<ref name='permissions'/> <ref name='format'/>
<ref name='timestamps'/> <ref name='permissions'/>
<optional> <ref name='timestamps'/>
<ref name='encryption'/> <optional>
</optional> <ref name='encryption'/>
<optional> </optional>
<ref name='compat'/> <optional>
</optional> <ref name='compat'/>
<optional> </optional>
<ref name='fileFormatFeatures'/> <optional>
</optional> <ref name='fileFormatFeatures'/>
</optional>
</interleave>
</element> </element>
</define> </define>
<define name='backingStore'> <define name='backingStore'>
<element name='backingStore'> <element name='backingStore'>
<element name='path'> <interleave>
<ref name='absFilePath'/> <element name='path'>
</element> <ref name='absFilePath'/>
<ref name='format'/> </element>
<ref name='permissions'/> <ref name='format'/>
<ref name='permissions'/>
</interleave>
</element> </element>
</define> </define>
......
<volume> <volume>
<name>sparse.img</name> <!-- lines scrambled to test interleaves -->
<key>/var/lib/libvirt/images/sparse.img</key> <key>/var/lib/libvirt/images/sparse.img</key>
<source/>
<capacity unit='GB'>10</capacity> <capacity unit='GB'>10</capacity>
<allocation unit='MiB'>0</allocation> <source/>
<target> <target>
<path>/var/lib/libvirt/images/sparse.img</path>
<permissions> <permissions>
<mode>0</mode>
<owner>0744</owner> <owner>0744</owner>
<mode>0</mode>
<group>0</group> <group>0</group>
</permissions> </permissions>
<path>/var/lib/libvirt/images/sparse.img</path>
</target> </target>
<allocation unit='MiB'>0</allocation>
<backingStore> <backingStore>
<path>/var/lib/virt/images/master.img</path>
<format type='vmdk'/> <format type='vmdk'/>
<path>/var/lib/virt/images/master.img</path>
<permissions> <permissions>
<mode>0744</mode> <mode>0744</mode>
<label>virt_image_t</label>
<owner>1</owner> <owner>1</owner>
<group>1</group> <group>1</group>
<label>virt_image_t</label>
</permissions> </permissions>
</backingStore> </backingStore>
<name>sparse.img</name>
</volume> </volume>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册