storage: allow interleave in pool XML

The RNG grammar did not allow arbitrary interleaving, which makes
it harder than necessary to create a new pool from handwritten XML.

* docs/schemas/storagepool.rng: Allow interleaving.
* tests/storagepoolxml2xmlin/pool-sheepdog.xml: Test interleave.
* tests/storagepoolxml2xmlin/pool-iscsi-auth.xml: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2013-10-15 16:59:48 -06:00
parent 59dce8d278
commit caf516db51
3 changed files with 211 additions and 163 deletions

View File

@ -29,192 +29,224 @@
<attribute name='type'>
<value>dir</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedir'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedir'/>
<ref name='target'/>
</interleave>
</define>
<define name='poolfs'>
<attribute name='type'>
<value>fs</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcefs'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcefs'/>
<ref name='target'/>
</interleave>
</define>
<define name='poolnetfs'>
<attribute name='type'>
<value>netfs</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcenetfs'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcenetfs'/>
<ref name='target'/>
</interleave>
</define>
<define name='poollogical'>
<attribute name='type'>
<value>logical</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcelogical'/>
<ref name='targetlogical'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcelogical'/>
<ref name='targetlogical'/>
</interleave>
</define>
<define name='pooldisk'>
<attribute name='type'>
<value>disk</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedisk'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedisk'/>
<ref name='target'/>
</interleave>
</define>
<define name='pooliscsi'>
<attribute name='type'>
<value>iscsi</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourceiscsi'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourceiscsi'/>
<ref name='target'/>
</interleave>
</define>
<define name='poolscsi'>
<attribute name='type'>
<value>scsi</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcescsi'/>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcescsi'/>
<ref name='target'/>
</interleave>
</define>
<define name='poolmpath'>
<attribute name='type'>
<value>mpath</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<optional>
<ref name='sourcempath'/>
</optional>
<ref name='target'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<optional>
<ref name='sourcempath'/>
</optional>
<ref name='target'/>
</interleave>
</define>
<define name='poolrbd'>
<attribute name='type'>
<value>rbd</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcerbd'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcerbd'/>
</interleave>
</define>
<define name='poolsheepdog'>
<attribute name='type'>
<value>sheepdog</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcesheepdog'/>
<interleave>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcesheepdog'/>
</interleave>
</define>
<define name='sourceinfovendor'>
<optional>
<element name='vendor'>
<attribute name='name'>
<text/>
</attribute>
</element>
</optional>
<optional>
<element name='product'>
<attribute name='name'>
<text/>
</attribute>
</element>
</optional>
<interleave>
<optional>
<element name='vendor'>
<attribute name='name'>
<text/>
</attribute>
</element>
</optional>
<optional>
<element name='product'>
<attribute name='name'>
<text/>
</attribute>
</element>
</optional>
</interleave>
</define>
<define name='commonmetadata'>
<element name='name'>
<ref name='genericName'/>
</element>
<optional>
<element name='uuid'>
<ref name='UUID'/>
<interleave>
<element name='name'>
<ref name='genericName'/>
</element>
</optional>
<optional>
<element name='uuid'>
<ref name='UUID'/>
</element>
</optional>
</interleave>
</define>
<define name='sizing'>
<optional>
<element name='capacity'>
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name='allocation'>
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name='available'>
<ref name='scaledInteger'/>
</element>
</optional>
<interleave>
<optional>
<element name='capacity'>
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name='allocation'>
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name='available'>
<ref name='scaledInteger'/>
</element>
</optional>
</interleave>
</define>
<define name='permissions'>
<optional>
<element name='permissions'>
<element name='mode'>
<ref name='octalMode'/>
</element>
<element name='owner'>
<choice>
<ref name='unsignedInt'/>
<value>-1</value>
</choice>
</element>
<element name='group'>
<choice>
<ref name='unsignedInt'/>
<value>-1</value>
</choice>
</element>
<optional>
<element name='label'>
<text/>
</element>
</optional>
<interleave>
<element name='mode'>
<ref name='octalMode'/>
</element>
<element name='owner'>
<choice>
<ref name='unsignedInt'/>
<value>-1</value>
</choice>
</element>
<element name='group'>
<choice>
<ref name='unsignedInt'/>
<value>-1</value>
</choice>
</element>
<optional>
<element name='label'>
<text/>
</element>
</optional>
</interleave>
</element>
</optional>
</define>
<define name='target'>
<element name='target'>
<element name='path'>
<ref name='absFilePath'/>
</element>
<ref name='permissions'/>
<interleave>
<element name='path'>
<ref name='absFilePath'/>
</element>
<ref name='permissions'/>
</interleave>
</element>
</define>
<define name='targetlogical'>
<element name='target'>
<optional>
<element name='path'>
<ref name='absFilePath'/>
</element>
</optional>
<ref name='permissions'/>
<interleave>
<optional>
<element name='path'>
<ref name='absFilePath'/>
</element>
</optional>
<ref name='permissions'/>
</interleave>
</element>
</define>
@ -413,74 +445,86 @@
<define name='sourcefs'>
<element name='source'>
<ref name='sourceinfodev'/>
<ref name='sourcefmtfs'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
<interleave>
<ref name='sourceinfodev'/>
<ref name='sourcefmtfs'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
<define name='sourcenetfs'>
<element name='source'>
<ref name='sourceinfohost'/>
<ref name='sourceinfodir'/>
<ref name='sourcefmtnetfs'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
<interleave>
<ref name='sourceinfohost'/>
<ref name='sourceinfodir'/>
<ref name='sourcefmtnetfs'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
<define name='sourcelogical'>
<element name='source'>
<oneOrMore>
<interleave>
<oneOrMore>
<optional>
<ref name='sourceinfoname'/>
</optional>
<optional>
<ref name='sourceinfodev'/>
</optional>
</oneOrMore>
<ref name='sourcefmtlogical'/>
<optional>
<ref name='sourceinfoname'/>
<ref name='sourceinfovendor'/>
</optional>
<optional>
<ref name='sourceinfodev'/>
</optional>
</oneOrMore>
<ref name='sourcefmtlogical'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
<define name='sourcedisk'>
<element name='source'>
<ref name='sourceinfodev'/>
<ref name='sourcefmtdisk'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
<interleave>
<ref name='sourceinfodev'/>
<ref name='sourcefmtdisk'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
<define name='sourceiscsi'>
<element name='source'>
<ref name='sourceinfohost'/>
<ref name='sourceinfodev'/>
<optional>
<ref name='initiatorinfo'/>
</optional>
<optional>
<ref name='sourceinfoauth'/>
</optional>
<optional>
<ref name='sourceinfovendor'/>
</optional>
<interleave>
<ref name='sourceinfohost'/>
<ref name='sourceinfodev'/>
<optional>
<ref name='initiatorinfo'/>
</optional>
<optional>
<ref name='sourceinfoauth'/>
</optional>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
<define name='sourcescsi'>
<element name='source'>
<ref name='sourceinfoadapter'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
<interleave>
<ref name='sourceinfoadapter'/>
<optional>
<ref name='sourceinfovendor'/>
</optional>
</interleave>
</element>
</define>
@ -492,18 +536,22 @@
<define name='sourcerbd'>
<element name='source'>
<ref name='sourceinfoname'/>
<ref name='sourceinfohost'/>
<optional>
<ref name='sourceinfoauth'/>
</optional>
<interleave>
<ref name='sourceinfoname'/>
<ref name='sourceinfohost'/>
<optional>
<ref name='sourceinfoauth'/>
</optional>
</interleave>
</element>
</define>
<define name='sourcesheepdog'>
<element name='source'>
<ref name='sourceinfohost'/>
<ref name='sourceinfoname'/>
<interleave>
<ref name='sourceinfohost'/>
<ref name='sourceinfoname'/>
</interleave>
</element>
</define>

View File

@ -1,19 +1,19 @@
<pool type='iscsi'>
<name>virtimages</name>
<uuid>e9392370-2917-565e-692b-d057f46512d6</uuid>
<source>
<host name="iscsi.example.com"/>
<device path="demo-target"/>
<auth type='chap' username='admin'>
<secret uuid='2ec115d7-3a88-3ceb-bc12-0ac909a6fd87'/>
</auth>
<device path="demo-target"/>
<host name="iscsi.example.com"/>
</source>
<uuid>e9392370-2917-565e-692b-d057f46512d6</uuid>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<mode>0700</mode>
<group>0</group>
</permissions>
<path>/dev/disk/by-path</path>
</target>
<name>virtimages</name>
</pool>

View File

@ -1,8 +1,8 @@
<pool type='sheepdog'>
<name>sheepdog</name>
<uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad7</uuid>
<source>
<host name='localhost' port='7000'/>
<name>sheepdog</name>
<host name='localhost' port='7000'/>
</source>
<uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad7</uuid>
<name>sheepdog</name>
</pool>