]> xenbits.xensource.com Git - libvirt.git/commitdiff
docs: Add schema for storage pool capabilities
authorJohn Ferlan <jferlan@redhat.com>
Thu, 7 Feb 2019 17:29:15 +0000 (12:29 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 6 Mar 2019 16:12:48 +0000 (11:12 -0500)
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>
docs/schemas/storagepoolcaps.rng [new file with mode: 0644]
libvirt.spec.in
mingw-libvirt.spec.in
tests/Makefile.am
tests/storagepoolcapsschemadata/poolcaps-full.xml [new file with mode: 0644]
tests/virschematest.c

diff --git a/docs/schemas/storagepoolcaps.rng b/docs/schemas/storagepoolcaps.rng
new file mode 100644 (file)
index 0000000..e3bf1ef
--- /dev/null
@@ -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>
index 9beffba203998fbd5121fec0d017ad77e03615bb..82681eea4264a6ba3f79a7d332358f8795582887 100644 (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
index 249abb8475fab80df4dc8ad88cd3d47e1ee91c00..bea822fd73678e0bbfb4d1f4f6d2de80b50cc0d8 100644 (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
index c3f633cee0f3a1deae34ccccafb1159d039f4715..760f600bf2af8effb2fcdccc3103e0f88d8054c3 100644 (file)
@@ -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 (file)
index 0000000..0bb3faf
--- /dev/null
@@ -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>
index d1bcdeac9c5b5a0ec37ed7686c98cd8e9cb11500..a89a26b9181846823b0c0dfb14c9c5784c34103d 100644 (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",