From: Daniel P. Berrange Date: Tue, 27 Jan 2009 15:29:53 +0000 (+0000) Subject: Added complete set of RNG schemas for all XML formats X-Git-Tag: LIBVIRT_0_6_0~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c22a68ce295088cea5859e3ec63423893136fef;p=thirdparty%2Flibvirt.git Added complete set of RNG schemas for all XML formats --- diff --git a/ChangeLog b/ChangeLog index ece493c0bc..476159ccd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +Tue Jan 27 15:18:16 GMT 2009 Daniel P. Berrange + + Add RNG schemas for all XML file formats used in API. + * configure.in: Add docs/schema/Makefile.in to output files + * libvirt.spec.in, mingw32-libvirt.spec.in: Package RNG schemas + from $datadir/libvirt/schemas + * docs/Makefile.am, docs/libvirt.rng, docs/network.rng: Remove + RNGs schemas + * docs/schemas/Makefile.am: Install RNG schemas to $datadir/libvirt + * docs/schemas/capability.rng: Schema for host capability XML + * docs/schemas/domain.rng: Schema for host capability XML + * docs/schemas/network.rng: Schema for guest domain XML + * docs/schemas/nodedev.rng: Schema for virtual network XML + * docs/schemas/storagepool.rng: Schema for storage pool XML + * docs/schemas/storagevol.rng: Schema for storage volume XML + * tests/Makefile.am, capabilityschematest, networkschematest, + nodedevschematest, storagepoolschematest, storagevolschematest: + New test cases to validate example XML files against schemeas. + * tests/capabilityschemadata/*.xml, tests/nodedevschemadata/*.xml, + tests/storagepoolschemadata/*.xml, tests/storagevolschemadata/*.xml: + New datafiles for schema validation tests. + Tue Jan 27 14:28:16 GMT 2009 Daniel P. Berrange * docs/index.html.in: Add link to libvirt-qpid & UML driver info diff --git a/configure.in b/configure.in index dab68358a7..7efe26219c 100644 --- a/configure.in +++ b/configure.in @@ -1272,6 +1272,7 @@ cp -f COPYING.LIB COPYING AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \ docs/examples/Makefile docs/devhelp/Makefile \ docs/examples/python/Makefile \ + docs/schemas/Makefile \ gnulib/lib/Makefile \ gnulib/tests/Makefile \ libvirt.pc libvirt.spec mingw32-libvirt.spec \ diff --git a/docs/Makefile.am b/docs/Makefile.am index bacf7b84a1..abb0529152 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS= . examples devhelp +SUBDIRS= schemas examples devhelp # The directory containing the source code (if it contains documentation). DOC_SOURCE_DIR=../src @@ -52,10 +52,6 @@ xml = \ testnetpriv.xml \ testnode.xml -rng = \ - libvirt.rng \ - network.rng - fig = \ libvirt-net-logical.fig \ libvirt-net-physical.fig @@ -64,7 +60,7 @@ EXTRA_DIST= \ libvirt-api.xml libvirt-refs.xml apibuild.py \ site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ - $(xml) $(rng) $(fig) $(png) \ + $(xml) $(fig) $(png) \ virsh.pod ChangeLog.awk all: web $(top_builddir)/NEWS $(man_MANS) diff --git a/docs/schemas/.cvsignore b/docs/schemas/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/docs/schemas/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/docs/schemas/Makefile.am b/docs/schemas/Makefile.am new file mode 100644 index 0000000000..c4ef0b1cae --- /dev/null +++ b/docs/schemas/Makefile.am @@ -0,0 +1,12 @@ + + +schemadir = $(pkgdatadir)/schemas +schema_DATA = \ + domain.rng \ + network.rng \ + storagepool.rng \ + storagevol.rng \ + nodedev.rng \ + capability.rng + +EXTRA_DIST = $(schema_DATA) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng new file mode 100644 index 0000000000..f848da2182 --- /dev/null +++ b/docs/schemas/capability.rng @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xenmigr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xen + linux + hvm + exe + uml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 31 + 32 + 64 + + + + + + + + + + + + + + + qemu + kqemu + kvm + xen + uml + lxc + openvz + test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + no + + + + + on + off + + + + + + + i686 + x86_64 + ppc + ppc64 + ia64 + s390 + mips + mipsel + sparc + + + + + + + [0-9]+ + + + + + + /[a-zA-Z0-9_\+\-/%]+ + + + + + diff --git a/docs/libvirt.rng b/docs/schemas/domain.rng similarity index 100% rename from docs/libvirt.rng rename to docs/schemas/domain.rng diff --git a/docs/network.rng b/docs/schemas/network.rng similarity index 100% rename from docs/network.rng rename to docs/schemas/network.rng index d84bb2d01f..34c0163185 100644 --- a/docs/network.rng +++ b/docs/schemas/network.rng @@ -27,6 +27,21 @@ + + + + + + + + nat + routed + + + + + @@ -51,19 +66,4 @@ - - - - - - - - nat - routed - - - - - diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng new file mode 100644 index 0000000000..ae6654c323 --- /dev/null +++ b/docs/schemas/nodedev.rng @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pci + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + usb_device + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + usb + + + + + + + + + + + + + + + + + + + + + + + + + net + + + + + + + + + + + + + + + + + + + + + + + + + + + + 80203 + + + + + + 80211 + + + + + + + scsi_host + + + + + + + + + + scsi + + + + + + + + + + + + + + + + + + + + + + + storage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hotpluggable + + + + + + + + + removable + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + [a-fA-F0-9]{32} + + + [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} + + + + + + + [0-9]+ + + + + + + (0x)?[0-9a-f]+ + + + + + + ([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2} + + + + + + /[a-zA-Z0-9_\+\-/%]+ + + + + diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng new file mode 100644 index 0000000000..e152e193bc --- /dev/null +++ b/docs/schemas/storagepool.rng @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + dir + + + + + + + + + + fs + + + + + + + + + + netfs + + + + + + + + + + logical + + + + + + + + + + disk + + + + + + + + + + iscsi + + + + + + + + + + scsi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auto + ext2 + ext3 + ext4 + ufs + iso9660 + udf + gfs + gfs2 + vfat + hfs+ + xfs + + + + + + + + + + + + + auto + nfs + + + + + + + + + + + + + none + dos + dvh + gpt + mac + bsd + pc98 + sun + lvm2 + + + + + + + + + + + + + auto + lvm2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9_\+\-]+ + + + + + + [a-fA-F0-9]{32} + + + [a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12} + + + + + + + [0-9]+ + + + + + + /[a-zA-Z0-9_\+\-/%]+ + + + + + diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng new file mode 100644 index 0000000000..c7bd3a70c7 --- /dev/null +++ b/docs/schemas/storagevol.rng @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + none + auto + ext2 + ext3 + ext4 + ufs + iso9660 + udf + gfs + gfs2 + vfat + hfs+ + xfs + + + + + + + + raw + dir + bochs + cloop + cow + dmg + iso + qcow + qcow2 + vmdk + vpc + + + + + + + + + + + + + + + + + + + [a-zA-Z0-9_\+\-\.]+ + + + + + + [0-9]+ + + + + + + /[a-zA-Z0-9_\+\-\./%]+ + + + + + diff --git a/libvirt.spec.in b/libvirt.spec.in index 9121c6d8bc..5a15de2346 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -354,6 +354,16 @@ fi %{_datadir}/libvirt/networks/default.xml %endif +%dir %{_datadir}/libvirt/ +%dir %{_datadir}/libvirt/schemas/ + +%{_datadir}/libvirt/schemas/domain.rng +%{_datadir}/libvirt/schemas/network.rng +%{_datadir}/libvirt/schemas/storagepool.rng +%{_datadir}/libvirt/schemas/storagevol.rng +%{_datadir}/libvirt/schemas/nodedev.rng +%{_datadir}/libvirt/schemas/capability.rng + %dir %{_localstatedir}/run/libvirt/ %dir %{_localstatedir}/lib/libvirt/ @@ -410,7 +420,6 @@ fi %attr(0755, root, root) %{_sbindir}/libvirtd %endif -%doc docs/*.rng %doc docs/*.xml %files devel diff --git a/mingw32-libvirt.spec.in b/mingw32-libvirt.spec.in index 5c83178499..1b6f73a2e7 100644 --- a/mingw32-libvirt.spec.in +++ b/mingw32-libvirt.spec.in @@ -80,6 +80,15 @@ rm -rf $RPM_BUILD_ROOT %{_mingw32_libdir}/libvirt.la %{_mingw32_libdir}/pkgconfig/libvirt.pc +%dir %{_mingw32_datadir}/libvirt/ +%dir %{_mingw32_datadir}/libvirt/schemas/ +%{_mingw32_datadir}/libvirt/schemas/domain.rng +%{_mingw32_datadir}/libvirt/schemas/network.rng +%{_mingw32_datadir}/libvirt/schemas/storagepool.rng +%{_mingw32_datadir}/libvirt/schemas/storagevol.rng +%{_mingw32_datadir}/libvirt/schemas/nodedev.rng +%{_mingw32_datadir}/libvirt/schemas/capability.rng + %{_mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo %dir %{_mingw32_includedir}/libvirt diff --git a/tests/Makefile.am b/tests/Makefile.am index 9924657cc8..e467a86e99 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -41,8 +41,17 @@ EXTRA_DIST = \ test-lib.sh \ qemuxml2argvdata \ nodeinfodata \ + capabilityschematest \ + capabilityschemadata \ + networkschematest \ domainschematest \ - domainschemadata + domainschemadata \ + storagepoolschematest \ + storagepoolschemadata \ + storagevolschematest \ + storagevolschemadata \ + nodedevschematest \ + nodedevschemadata noinst_PROGRAMS = virshtest conftest \ nodeinfotest statstest qparamtest @@ -55,7 +64,14 @@ if WITH_QEMU noinst_PROGRAMS += qemuxml2argvtest qemuxml2xmltest endif -test_scripts = domainschematest +test_scripts = \ + capabilityschematest \ + networkschematest \ + storagepoolschematest \ + storagevolschematest \ + domainschematest \ + nodedevschematest + if WITH_LIBVIRTD test_scripts += \ test_conf.sh \ diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml new file mode 100644 index 0000000000..fd8523e2d3 --- /dev/null +++ b/tests/capabilityschemadata/caps-qemu-kvm.xml @@ -0,0 +1,111 @@ + + + + + i686 + + + + + hvm + + 32 + /usr/bin/qemu + pc + isapc + + + + /usr/bin/qemu-kvm + + + + + + + + + + + + hvm + + 64 + /usr/bin/qemu-system-x86_64 + pc + isapc + + + + + + + + + + + hvm + + 32 + /usr/bin/qemu-system-mips + mips + + + + + + + hvm + + 32 + /usr/bin/qemu-system-mipsel + mips + + + + + + + hvm + + 32 + /usr/bin/qemu-system-sparc + sun4m + + + + + + + hvm + + 32 + /usr/bin/qemu-system-ppc + g3bw + mac99 + prep + + + + + + + xen + + 32 + /usr/bin/xenner + xenner + + + + + + + + + + + + + + diff --git a/tests/capabilityschemadata/caps-test.xml b/tests/capabilityschemadata/caps-test.xml new file mode 100644 index 0000000000..1313c952cc --- /dev/null +++ b/tests/capabilityschemadata/caps-test.xml @@ -0,0 +1,71 @@ + + + + + i686 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hvm + + 32 + /usr/bin/test-hv + + + + + + + + + + + xen + + 32 + /usr/bin/test-hv + + + + + + + + + + + + diff --git a/tests/capabilityschematest b/tests/capabilityschematest new file mode 100755 index 0000000000..a166724b71 --- /dev/null +++ b/tests/capabilityschematest @@ -0,0 +1,34 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` + +DOMAINDIRS="capabilityschemadata xencapsdata" + + +n=0 +f=0 +for dir in $DOMAINDIRS +do + XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1 + + for xml in $XML + do + n=`expr $n + 1` + printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) + result=`xmllint --relaxng $srcdir/../docs/schemas/capability.rng --noout $xml 2>&1` + ret=$? + if test $ret = 0; then + echo "OK" + else + echo "FAILED" + echo $result + f=`expr $f + 1` + fi + done +done +echo "Validated $n files, $f failed" + +ret=0 +test $f != 0 && ret=255 +exit $ret diff --git a/tests/domainschematest b/tests/domainschematest index d85d4631b4..0a7d4a1860 100755 --- a/tests/domainschematest +++ b/tests/domainschematest @@ -1,6 +1,7 @@ #!/bin/sh test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` DOMAINDIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata" @@ -14,7 +15,7 @@ do do n=`expr $n + 1` printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) - result=`xmllint --relaxng $srcdir/../docs/libvirt.rng --noout $xml 2>&1` + result=`xmllint --relaxng $srcdir/../docs/schemas/domain.rng --noout $xml 2>&1` ret=$? if test $ret = 0; then echo "OK" diff --git a/tests/networkschematest b/tests/networkschematest new file mode 100755 index 0000000000..1d7cffc207 --- /dev/null +++ b/tests/networkschematest @@ -0,0 +1,33 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` + +DIRS="../qemud" + +n=0 +f=0 +for dir in $DIRS +do + XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1 + + for xml in $XML + do + n=`expr $n + 1` + printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) + result=`xmllint --relaxng $srcdir/../docs/schemas/network.rng --noout $xml 2>&1` + ret=$? + if test $ret = 0; then + echo "OK" + else + echo "FAILED" + echo $result + f=`expr $f + 1` + fi + done +done +echo "Validated $n files, $f failed" + +ret=0 +test $f != 0 && ret=255 +exit $ret diff --git a/tests/nodedevschemadata/DVD_GCC_4247N.xml b/tests/nodedevschemadata/DVD_GCC_4247N.xml new file mode 100644 index 0000000000..d81e9834a5 --- /dev/null +++ b/tests/nodedevschemadata/DVD_GCC_4247N.xml @@ -0,0 +1,17 @@ + + DVD_GCC_4247N + pci_8086_27df_scsi_host_scsi_device_lun0 + + /dev/sr0 + scsi + cdrom + RW/DVD GCC-4247N + HL-DT-ST + + 0 + 0 + + + + + diff --git a/tests/nodedevschemadata/computer.xml b/tests/nodedevschemadata/computer.xml new file mode 100644 index 0000000000..4172c0c2ff --- /dev/null +++ b/tests/nodedevschemadata/computer.xml @@ -0,0 +1,18 @@ + + computer + + + LENOVO + ThinkPad T60p + 123123 + 12345678-1234-1234-9596-a088b277d677 + + + LENOVO + 79ETE1WW (2.21 ) + 02/05/2008 + + + + + diff --git a/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml new file mode 100644 index 0000000000..9a09246561 --- /dev/null +++ b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml @@ -0,0 +1,11 @@ + + net_00_13_02_b9_f9_d3 + pci_8086_4227 + + eth0 +
00:13:02:b9:f9:d3
+ + +
+ + diff --git a/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml new file mode 100644 index 0000000000..b13215c373 --- /dev/null +++ b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml @@ -0,0 +1,11 @@ + + net_00_15_58_2f_e9_55 + pci_8086_109a + + eth1 +
00:15:58:2f:e9:55
+ + +
+ + diff --git a/tests/nodedevschemadata/pci_1002_71c4.xml b/tests/nodedevschemadata/pci_1002_71c4.xml new file mode 100644 index 0000000000..305ca32296 --- /dev/null +++ b/tests/nodedevschemadata/pci_1002_71c4.xml @@ -0,0 +1,14 @@ + + pci_1002_71c4 + pci_8086_27a1 + + 0 + 1 + 0 + 0 + M56GL [Mobility FireGL V5200] + ATI Technologies Inc + + + + diff --git a/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml new file mode 100644 index 0000000000..47937f1c7b --- /dev/null +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml @@ -0,0 +1,9 @@ + + pci_8086_27c5_scsi_host + pci_8086_27c5 + + 0 + + + + diff --git a/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml new file mode 100644 index 0000000000..b58ee73ed5 --- /dev/null +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml @@ -0,0 +1,9 @@ + + pci_8086_27c5_scsi_host_0 + pci_8086_27c5 + + 1 + + + + diff --git a/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml new file mode 100644 index 0000000000..09887a861e --- /dev/null +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml @@ -0,0 +1,13 @@ + + pci_8086_27c5_scsi_host_scsi_device_lun0 + pci_8086_27c5_scsi_host + + 0 + 0 + 0 + 0 + disk + + + + diff --git a/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml new file mode 100644 index 0000000000..18f95003ae --- /dev/null +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml @@ -0,0 +1,9 @@ + + pci_8086_27c5_scsi_host_scsi_host + pci_8086_27c5_scsi_host + + 0 + + + + diff --git a/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml new file mode 100644 index 0000000000..43294ac551 --- /dev/null +++ b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml @@ -0,0 +1,14 @@ + + storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE + pci_8086_27c5_scsi_host_scsi_device_lun0 + + /dev/sda + scsi + disk + HTS721010G9SA00 + ATA + 100030242816 + + + + diff --git a/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml new file mode 100644 index 0000000000..05999e8101 --- /dev/null +++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml @@ -0,0 +1,12 @@ + + usb_device_1d6b_1_0000_00_1d_0 + pci_8086_27c8 + + 2 + 1 + 1.1 root hub + Linux Foundation + + + + diff --git a/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml new file mode 100644 index 0000000000..bc951ffdf2 --- /dev/null +++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml @@ -0,0 +1,12 @@ + + usb_device_1d6b_1_0000_00_1d_0_if0 + usb_device_1d6b_1_0000_00_1d_0 + + 0 + 9 + 0 + 0 + + + + diff --git a/tests/nodedevschematest b/tests/nodedevschematest new file mode 100755 index 0000000000..23e9e57071 --- /dev/null +++ b/tests/nodedevschematest @@ -0,0 +1,33 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` + +DIRS="nodedevschemadata" + +n=0 +f=0 +for dir in $DIRS +do + XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1 + + for xml in $XML + do + n=`expr $n + 1` + printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) + result=`xmllint --relaxng $srcdir/../docs/schemas/nodedev.rng --noout $xml 2>&1` + ret=$? + if test $ret = 0; then + echo "OK" + else + echo "FAILED" + echo $result + f=`expr $f + 1` + fi + done +done +echo "Validated $n files, $f failed" + +ret=0 +test $f != 0 && ret=255 +exit $ret diff --git a/tests/storagepoolschemadata/pool-dir.xml b/tests/storagepoolschemadata/pool-dir.xml new file mode 100644 index 0000000000..2b8735c215 --- /dev/null +++ b/tests/storagepoolschemadata/pool-dir.xml @@ -0,0 +1,17 @@ + + virtimages + 70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2 + 0 + 0 + 0 + + + + /var/lib/libvirt/images + + 0700 + 0 + 0 + + + diff --git a/tests/storagepoolschemadata/pool-disk.xml b/tests/storagepoolschemadata/pool-disk.xml new file mode 100644 index 0000000000..4c27c5492a --- /dev/null +++ b/tests/storagepoolschemadata/pool-disk.xml @@ -0,0 +1,22 @@ + + sda + e3509a62-1b4c-e20b-94bd-9168963f9b97 + 100027630080 + 100027597824 + 0 + + + + + + + + + /dev + + 0700 + 0 + 0 + + + diff --git a/tests/storagepoolschemadata/pool-fs.xml b/tests/storagepoolschemadata/pool-fs.xml new file mode 100644 index 0000000000..c253c5507e --- /dev/null +++ b/tests/storagepoolschemadata/pool-fs.xml @@ -0,0 +1,20 @@ + + images + 7641d5a8-af11-f730-a34e-0a7dfcede71f + 0 + 0 + 0 + + + + + + /mnt + + 0700 + 0 + 0 + + + + diff --git a/tests/storagepoolschemadata/pool-iscsi.xml b/tests/storagepoolschemadata/pool-iscsi.xml new file mode 100644 index 0000000000..8d60f38b88 --- /dev/null +++ b/tests/storagepoolschemadata/pool-iscsi.xml @@ -0,0 +1,10 @@ + + virtimages + + + + + + /dev/disk/by-path + + diff --git a/tests/storagepoolschemadata/pool-logical.xml b/tests/storagepoolschemadata/pool-logical.xml new file mode 100644 index 0000000000..c4bfa07891 --- /dev/null +++ b/tests/storagepoolschemadata/pool-logical.xml @@ -0,0 +1,19 @@ + + HostVG + 1c13165a-d0f4-3aee-b447-30fb38789091 + 99891544064 + 99220455424 + 671088640 + + HostVG + + + + /dev/HostVG + + 0700 + 0 + 0 + + + diff --git a/tests/storagepoolschemadata/pool-netfs.xml b/tests/storagepoolschemadata/pool-netfs.xml new file mode 100644 index 0000000000..cb4252c723 --- /dev/null +++ b/tests/storagepoolschemadata/pool-netfs.xml @@ -0,0 +1,21 @@ + + nfsimages + 7641d5a8-af11-f730-a34e-0a7dfcede71f + 0 + 0 + 0 + + + + + + + /mnt + + 0700 + 0 + 0 + + + + diff --git a/tests/storagepoolschematest b/tests/storagepoolschematest new file mode 100755 index 0000000000..f6a973dae2 --- /dev/null +++ b/tests/storagepoolschematest @@ -0,0 +1,33 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` + +DIRS="storagepoolschemadata" + +n=0 +f=0 +for dir in $DIRS +do + XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1 + + for xml in $XML + do + n=`expr $n + 1` + printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) + result=`xmllint --relaxng $srcdir/../docs/schemas/storagepool.rng --noout $xml 2>&1` + ret=$? + if test $ret = 0; then + echo "OK" + else + echo "FAILED" + echo $result + f=`expr $f + 1` + fi + done +done +echo "Validated $n files, $f failed" + +ret=0 +test $f != 0 && ret=255 +exit $ret diff --git a/tests/storagevolschemadata/vol-logical.xml b/tests/storagevolschemadata/vol-logical.xml new file mode 100644 index 0000000000..2c3e7ce1ab --- /dev/null +++ b/tests/storagevolschemadata/vol-logical.xml @@ -0,0 +1,21 @@ + + Swap + r4xkCv-MQhr-WKIT-R66x-Epn2-e8hG-1Z5gY0 + + + + + + 2080374784 + 2080374784 + + /dev/HostVG/Swap + + 060660 + 0 + 6 + + + + + diff --git a/tests/storagevolschemadata/vol-partition.xml b/tests/storagevolschemadata/vol-partition.xml new file mode 100644 index 0000000000..2db7e9230b --- /dev/null +++ b/tests/storagevolschemadata/vol-partition.xml @@ -0,0 +1,21 @@ + + sda1 + /dev/sda1 + + + + + + 106896384 + 106896384 + + /dev/sda1 + + + 060660 + 0 + 6 + + + + diff --git a/tests/storagevolschemadata/vol-qcow2.xml b/tests/storagevolschemadata/vol-qcow2.xml new file mode 100644 index 0000000000..a3f5cca509 --- /dev/null +++ b/tests/storagevolschemadata/vol-qcow2.xml @@ -0,0 +1,28 @@ + + OtherDemo.img + /var/lib/libvirt/images/OtherDemo.img + + + 5242880000 + 294912 + + /var/lib/libvirt/images/OtherDemo.img + + + 0100644 + 0 + 0 + + + + + /var/lib/libvirt/images/BaseDemo.img + + + 0100644 + 0 + 0 + + + + diff --git a/tests/storagevolschematest b/tests/storagevolschematest new file mode 100755 index 0000000000..7865102a13 --- /dev/null +++ b/tests/storagevolschematest @@ -0,0 +1,33 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_srcdir" && abs_srcdir=`pwd` + +DIRS="storagevolschemadata" + +n=0 +f=0 +for dir in $DIRS +do + XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1 + + for xml in $XML + do + n=`expr $n + 1` + printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml) + result=`xmllint --relaxng $srcdir/../docs/schemas/storagevol.rng --noout $xml 2>&1` + ret=$? + if test $ret = 0; then + echo "OK" + else + echo "FAILED" + echo $result + f=`expr $f + 1` + fi + done +done +echo "Validated $n files, $f failed" + +ret=0 +test $f != 0 && ret=255 +exit $ret