docs: Add schema for storage pool capabilities

Define a schema for the storage pool capabilities along with
a test to show the general format.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
John Ferlan 2019-02-07 12:29:15 -05:00
parent 642c06fd63
commit 5dded8c806
6 changed files with 361 additions and 0 deletions

View File

@ -0,0 +1,88 @@
<?xml version="1.0"?>
<!-- A Relax NG schema for the libvirt storage pool capabilities 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='storagepoolCapabilities'/>
</start>
<define name='storagepoolCapabilities'>
<element name='storagepoolCapabilities'>
<zeroOrMore>
<ref name='poolCapsType'/>
</zeroOrMore>
</element>
</define>
<define name='poolCapsType'>
<element name='pool'>
<ref name='poolCapsTypes'/>
<ref name='poolCapsSupported'/>
<optional>
<ref name='poolCapsPoolOptions'/>
</optional>
<optional>
<ref name='poolCapsVolOptions'/>
</optional>
</element>
</define>
<define name='poolCapsTypes'>
<attribute name='type'>
<text/>
</attribute>
</define>
<define name='poolCapsSupported'>
<attribute name='supported'>
<ref name="virYesNo"/>
</attribute>
</define>
<define name='poolCapsPoolOptions'>
<element name='poolOptions'>
<optional>
<ref name='poolDefaultFormat'/>
</optional>
<optional>
<ref name='poolCapsEnum'/>
</optional>
</element>
</define>
<define name='poolCapsVolOptions'>
<element name='volOptions'>
<ref name='poolDefaultFormat'/>
<ref name='poolCapsEnum'/>
</element>
</define>
<define name='poolDefaultFormat'>
<element name='defaultFormat'>
<attribute name='type'>
<text/>
</attribute>
</element>
</define>
<define name='poolCapsEnum'>
<zeroOrMore>
<element name='enum'>
<attribute name='name'>
<text/>
</attribute>
<ref name='value'/>
</element>
</zeroOrMore>
</define>
<define name='value'>
<zeroOrMore>
<element name='value'>
<text/>
</element>
</zeroOrMore>
</define>
</grammar>

View File

@ -1822,6 +1822,7 @@ exit 0
%{_datadir}/libvirt/schemas/secret.rng
%{_datadir}/libvirt/schemas/storagecommon.rng
%{_datadir}/libvirt/schemas/storagepool.rng
%{_datadir}/libvirt/schemas/storagepoolcaps.rng
%{_datadir}/libvirt/schemas/storagevol.rng
%{_datadir}/libvirt/cpu_map/*.xml

View File

@ -252,6 +252,7 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh
%{mingw32_datadir}/libvirt/schemas/secret.rng
%{mingw32_datadir}/libvirt/schemas/storagecommon.rng
%{mingw32_datadir}/libvirt/schemas/storagepool.rng
%{mingw32_datadir}/libvirt/schemas/storagepoolcaps.rng
%{mingw32_datadir}/libvirt/schemas/storagevol.rng
%dir %{mingw32_datadir}/libvirt/api/
%{mingw32_datadir}/libvirt/api/libvirt-api.xml
@ -339,6 +340,7 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_libexecdir}/libvirt-guests.sh
%{mingw64_datadir}/libvirt/schemas/secret.rng
%{mingw64_datadir}/libvirt/schemas/storagecommon.rng
%{mingw64_datadir}/libvirt/schemas/storagepool.rng
%{mingw64_datadir}/libvirt/schemas/storagepoolcaps.rng
%{mingw64_datadir}/libvirt/schemas/storagevol.rng
%dir %{mingw64_datadir}/libvirt/api/
%{mingw64_datadir}/libvirt/api/libvirt-api.xml

View File

@ -136,6 +136,7 @@ EXTRA_DIST = \
securityselinuxhelperdata \
securityselinuxlabeldata \
sexpr2xmldata \
storagepoolcapsschemadata \
storagepoolschemadata \
storagepoolxml2xmlin \
storagepoolxml2xmlout \

View File

@ -0,0 +1,268 @@
<storagepoolCapabilities>
<pool type='dir' supported='yes'>
<volOptions>
<defaultFormat type='raw'/>
<enum name='targetFormatType'>
<value>none</value>
<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>
<value>ploop</value>
<value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
</enum>
</volOptions>
</pool>
<pool type='fs' supported='yes'>
<poolOptions>
<defaultFormat type='auto'/>
<enum name='sourceFormatType'>
<value>auto</value>
<value>ext2</value>
<value>ext3</value>
<value>ext4</value>
<value>ufs</value>
<value>iso9660</value>
<value>udf</value>
<value>gfs</value>
<value>gfs2</value>
<value>vfat</value>
<value>hfs+</value>
<value>xfs</value>
<value>ocfs2</value>
</enum>
<enum name='requiredSourceElements'>
<value>device</value>
</enum>
</poolOptions>
<volOptions>
<defaultFormat type='raw'/>
<enum name='targetFormatType'>
<value>none</value>
<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>
<value>ploop</value>
<value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
</enum>
</volOptions>
</pool>
<pool type='netfs' supported='yes'>
<poolOptions>
<defaultFormat type='auto'/>
<enum name='sourceFormatType'>
<value>auto</value>
<value>nfs</value>
<value>glusterfs</value>
<value>cifs</value>
</enum>
<enum name='requiredSourceElements'>
<value>host</value>
<value>dir</value>
</enum>
</poolOptions>
<volOptions>
<defaultFormat type='raw'/>
<enum name='targetFormatType'>
<value>none</value>
<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>
<value>ploop</value>
<value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
</enum>
</volOptions>
</pool>
<pool type='logical' supported='yes'>
<poolOptions>
<defaultFormat type='lvm2'/>
<enum name='sourceFormatType'>
<value>unknown</value>
<value>lvm2</value>
</enum>
<enum name='requiredSourceElements'>
<value>device</value>
<value>name</value>
</enum>
</poolOptions>
</pool>
<pool type='disk' supported='yes'>
<poolOptions>
<defaultFormat type='unknown'/>
<enum name='sourceFormatType'>
<value>unknown</value>
<value>dos</value>
<value>dvh</value>
<value>gpt</value>
<value>mac</value>
<value>bsd</value>
<value>pc98</value>
<value>sun</value>
<value>lvm2</value>
</enum>
<enum name='requiredSourceElements'>
<value>device</value>
</enum>
</poolOptions>
<volOptions>
<defaultFormat type='none'/>
<enum name='targetFormatType'>
<value>none</value>
<value>linux</value>
<value>fat16</value>
<value>fat32</value>
<value>linux-swap</value>
<value>linux-lvm</value>
<value>linux-raid</value>
<value>extended</value>
</enum>
</volOptions>
</pool>
<pool type='iscsi' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>host</value>
<value>device</value>
<value>initiator</value>
</enum>
</poolOptions>
</pool>
<pool type='iscsi-direct' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>host</value>
<value>device</value>
<value>initiator</value>
<value>network</value>
</enum>
</poolOptions>
</pool>
<pool type='scsi' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>adapter</value>
</enum>
</poolOptions>
</pool>
<pool type='mpath' supported='yes'>
</pool>
<pool type='rbd' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>host</value>
<value>name</value>
<value>network</value>
</enum>
</poolOptions>
</pool>
<pool type='sheepdog' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>host</value>
<value>name</value>
<value>network</value>
</enum>
</poolOptions>
</pool>
<pool type='gluster' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>host</value>
<value>dir</value>
<value>name</value>
<value>network</value>
</enum>
</poolOptions>
<volOptions>
<defaultFormat type='raw'/>
<enum name='targetFormatType'>
<value>none</value>
<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>
<value>ploop</value>
<value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
</enum>
</volOptions>
</pool>
<pool type='zfs' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>device</value>
<value>name</value>
</enum>
</poolOptions>
</pool>
<pool type='vstorage' supported='yes'>
<poolOptions>
<enum name='requiredSourceElements'>
<value>name</value>
</enum>
</poolOptions>
<volOptions>
<defaultFormat type='raw'/>
<enum name='targetFormatType'>
<value>none</value>
<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>
<value>ploop</value>
<value>cow</value>
<value>qcow</value>
<value>qcow2</value>
<value>qed</value>
<value>vmdk</value>
</enum>
</volOptions>
</pool>
</storagepoolCapabilities>

View File

@ -231,6 +231,7 @@ mymain(void)
DO_TEST_DIR("nwfilter.rng", "nwfilterxml2xmlout", "../examples/xml/nwfilter");
DO_TEST_DIR("nwfilterbinding.rng", "virnwfilterbindingxml2xmldata");
DO_TEST_DIR("secret.rng", "secretxml2xmlin");
DO_TEST_DIR("storagepoolcaps.rng", "storagepoolcapsschemadata");
DO_TEST_DIR("storagepool.rng", "storagepoolxml2xmlin", "storagepoolxml2xmlout",
"storagepoolschemadata");
DO_TEST_DIR("storagevol.rng", "storagevolxml2xmlin", "storagevolxml2xmlout",