Define a schema for the storage pool capabilities along with
a test to show the general format.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
docs/schemas/storagepoolcaps.rng | 88 ++++++
libvirt.spec.in | 1 +
mingw-libvirt.spec.in | 2 +
tests/Makefile.am | 1 +
.../poolcaps-full.xml | 268 ++++++++++++++++++
tests/virschematest.c | 1 +
6 files changed, 361 insertions(+)
create mode 100644 docs/schemas/storagepoolcaps.rng
create mode 100644 tests/storagepoolcapsschemadata/poolcaps-full.xml
diff --git a/docs/schemas/storagepoolcaps.rng b/docs/schemas/storagepoolcaps.rng
new file mode 100644
index 0000000000..e3bf1efcde
--- /dev/null
+++ b/docs/schemas/storagepoolcaps.rng
@@ -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>
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9beffba203..82681eea42 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -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
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 249abb8475..bea822fd73 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -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
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c3f633cee0..760f600bf2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -136,6 +136,7 @@ EXTRA_DIST = \
securityselinuxhelperdata \
securityselinuxlabeldata \
sexpr2xmldata \
+ storagepoolcapsschemadata \
storagepoolschemadata \
storagepoolxml2xmlin \
storagepoolxml2xmlout \
diff --git a/tests/storagepoolcapsschemadata/poolcaps-full.xml
b/tests/storagepoolcapsschemadata/poolcaps-full.xml
new file mode 100644
index 0000000000..0bb3faf04e
--- /dev/null
+++ b/tests/storagepoolcapsschemadata/poolcaps-full.xml
@@ -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>
diff --git a/tests/virschematest.c b/tests/virschematest.c
index d1bcdeac9c..a89a26b918 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -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",
--
2.20.1