提交 2c22a68c 编写于 作者: D Daniel P. Berrange

Added complete set of RNG schemas for all XML formats

上级 04b120e4
Tue Jan 27 15:18:16 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
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 <berrange@redhat.com>
* docs/index.html.in: Add link to libvirt-qpid & UML driver info
......
......@@ -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 \
......
## 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)
......
Makefile
Makefile.in
schemadir = $(pkgdatadir)/schemas
schema_DATA = \
domain.rng \
network.rng \
storagepool.rng \
storagevol.rng \
nodedev.rng \
capability.rng
EXTRA_DIST = $(schema_DATA)
<!-- A Relax NG schema for the libvirt node device XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- We handle only document defining a domain -->
<start>
<ref name='capabilities'/>
</start>
<define name='capabilities'>
<element name='capabilities'>
<ref name='hostcaps'/>
<zeroOrMore>
<ref name='guestcaps'/>
</zeroOrMore>
</element>
</define>
<define name='hostcaps'>
<element name='host'>
<element name='cpu'>
<element name='arch'>
<ref name='archnames'/>
</element>
<optional>
<ref name='cpufeatures'/>
</optional>
</element>
<optional>
<ref name='migration'/>
</optional>
<optional>
<ref name='topology'/>
</optional>
</element>
</define>
<define name='cpufeatures'>
<element name='features'>
<optional>
<element name='pae'><empty/></element>
</optional>
<optional>
<element name='nonpae'><empty/></element>
</optional>
<optional>
<element name='vmx'><empty/></element>
</optional>
<optional>
<element name='svm'><empty/></element>
</optional>
</element>
</define>
<define name='migration'>
<element name='migration_features'>
<optional>
<element name='live'>
<empty/>
</element>
</optional>
<optional>
<element name='uri_transports'>
<oneOrMore>
<element name='uri_transport'>
<choice>
<value>xenmigr</value>
</choice>
</element>
</oneOrMore>
</element>
</optional>
</element>
</define>
<define name='topology'>
<element name='topology'>
<element name='cells'>
<attribute name='num'>
<ref name='uint'/>
</attribute>
<oneOrMore>
<ref name='cell'/>
</oneOrMore>
</element>
</element>
</define>
<define name='cell'>
<element name='cell'>
<attribute name='id'>
<ref name='uint'/>
</attribute>
<optional>
<element name='cpus'>
<attribute name='num'>
<ref name='uint'/>
</attribute>
<oneOrMore>
<ref name='cpu'/>
</oneOrMore>
</element>
</optional>
</element>
</define>
<define name='cpu'>
<element name='cpu'>
<attribute name='id'>
<ref name='uint'/>
</attribute>
</element>
</define>
<define name='guestcaps'>
<element name='guest'>
<ref name='ostype'/>
<ref name='arch'/>
<optional>
<ref name='features'/>
</optional>
</element>
</define>
<define name='ostype'>
<element name='os_type'>
<choice>
<value>xen</value> <!-- Xen 3.0 pv -->
<value>linux</value> <!-- same as 'xen' - legacy -->
<value>hvm</value> <!-- unmodified OS -->
<value>exe</value> <!-- For container based virt -->
<value>uml</value> <!-- user mode linux -->
</choice>
</element>
</define>
<define name='arch'>
<element name='arch'>
<attribute name='name'>
<ref name='archnames'/>
</attribute>
<ref name='wordsize'/>
<optional>
<ref name='emulator'/>
</optional>
<optional>
<ref name='loader'/>
</optional>
<zeroOrMore>
<ref name='machine'/>
</zeroOrMore>
<oneOrMore>
<ref name='domain'/>
</oneOrMore>
</element>
</define>
<define name='emulator'>
<element name='emulator'>
<ref name='path'/>
</element>
</define>
<define name='loader'>
<element name='loader'>
<ref name='path'/>
</element>
</define>
<define name='wordsize'>
<element name='wordsize'>
<choice>
<value>31</value>
<value>32</value>
<value>64</value>
</choice>
</element>
</define>
<define name='machine'>
<element name='machine'>
<text/>
</element>
</define>
<define name='domain'>
<element name='domain'>
<attribute name='type'>
<choice>
<value>qemu</value>
<value>kqemu</value>
<value>kvm</value>
<value>xen</value>
<value>uml</value>
<value>lxc</value>
<value>openvz</value>
<value>test</value>
</choice>
</attribute>
<optional>
<ref name='emulator'/>
</optional>
<optional>
<ref name='machine'/>
</optional>
</element>
</define>
<define name='features'>
<element name='features'>
<optional>
<element name='pae'>
<empty/>
</element>
</optional>
<optional>
<element name='nonpae'>
<empty/>
</element>
</optional>
<optional>
<element name='ia64_be'>
<empty/>
</element>
</optional>
<optional>
<element name='acpi'>
<ref name='featuretoggle'/>
<empty/>
</element>
</optional>
<optional>
<element name='apic'>
<ref name='featuretoggle'/>
<empty/>
</element>
</optional>
</element>
</define>
<define name='featuretoggle'>
<attribute name='toggle'>
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
<attribute name='default'>
<choice>
<value>on</value>
<value>off</value>
</choice>
</attribute>
</define>
<define name='archnames'>
<choice>
<value>i686</value>
<value>x86_64</value>
<value>ppc</value>
<value>ppc64</value>
<value>ia64</value>
<value>s390</value>
<value>mips</value>
<value>mipsel</value>
<value>sparc</value>
</choice>
</define>
<define name='uint'>
<data type='string'>
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name='path'>
<data type='string'>
<param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
</data>
</define>
</grammar>
......@@ -27,6 +27,21 @@
</optional>
</element>
</optional>
<optional>
<!-- The device through which the bridge is connected to the
rest of the network -->
<element name="forward">
<optional><attribute name="dev"><text/></attribute></optional>
<optional>
<attribute name="mode">
<choice>
<value>nat</value>
<value>routed</value>
</choice>
</attribute>
</optional>
</element>
</optional>
<optional>
<!-- The IP element sets up NAT'ing and an optional DHCP server
local to the host. -->
......@@ -51,19 +66,4 @@
</element>
</element>
</optional>
<optional>
<!-- The device through which the bridge is connected to the
rest of the network -->
<element name="forward">
<optional><attribute name="dev"><text/></attribute></optional>
<optional>
<attribute name="mode">
<choice>
<value>nat</value>
<value>routed</value>
</choice>
</attribute>
</optional>
</element>
</optional>
</element>
<!-- A Relax NG schema for the libvirt node device XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- We handle only document defining a domain -->
<start>
<ref name='device'/>
</start>
<!--
We handle only document defining a domain
-->
<define name='device'>
<element name="device">
<!-- The name of the network, used to refer to it through the API
and in virsh -->
<element name="name"><text/></element>
<optional>
<element name="parent"><text/></element>
</optional>
<zeroOrMore>
<ref name="capability"/>
</zeroOrMore>
</element>
</define>
<define name='capability'>
<element name="capability">
<choice>
<ref name="capsystem"/>
<ref name="cappcidev"/>
<ref name="capusbdev"/>
<ref name="capusbinterface"/>
<ref name="capnet"/>
<ref name="capscsihost"/>
<ref name="capscsi"/>
<ref name="capstorage"/>
</choice>
</element>
</define>
<define name='capsystem'>
<attribute name='type'>
<value>system</value>
</attribute>
<optional>
<element name='product'><text/></element>
</optional>
<element name='hardware'>
<optional>
<element name='vendor'><text/></element>
</optional>
<optional>
<element name='version'><text/></element>
</optional>
<optional>
<element name='serial'><text/></element>
</optional>
<element name='uuid'>
<ref name='uuid'/>
</element>
</element>
<element name='firmware'>
<optional>
<element name='vendor'><text/></element>
</optional>
<optional>
<element name='version'><text/></element>
</optional>
<optional>
<element name='release_date'><text/></element>
</optional>
</element>
</define>
<define name='cappcidev'>
<attribute name='type'>
<value>pci</value>
</attribute>
<element name='domain'>
<ref name='uint'/>
</element>
<element name='bus'>
<ref name='uint'/>
</element>
<element name='slot'>
<ref name='uint'/>
</element>
<element name='function'>
<ref name='uint'/>
</element>
<element name='product'>
<attribute name='id'>
<ref name='hexuint'/>
</attribute>
<choice>
<text/>
<empty/>
</choice>
</element>
<element name='vendor'>
<attribute name='id'>
<ref name='hexuint'/>
</attribute>
<choice>
<text/>
<empty/>
</choice>
</element>
</define>
<define name='capusbdev'>
<attribute name='type'>
<value>usb_device</value>
</attribute>
<element name='bus'>
<ref name='uint'/>
</element>
<element name='device'>
<ref name='uint'/>
</element>
<element name='product'>
<attribute name='id'>
<ref name='hexuint'/>
</attribute>
<choice>
<text/>
<empty/>
</choice>
</element>
<element name='vendor'>
<attribute name='id'>
<ref name='hexuint'/>
</attribute>
<choice>
<text/>
<empty/>
</choice>
</element>
</define>
<define name='capusbinterface'>
<attribute name='type'>
<value>usb</value>
</attribute>
<element name='number'>
<ref name='uint'/>
</element>
<element name='class'>
<ref name='uint'/>
</element>
<element name='subclass'>
<ref name='uint'/>
</element>
<element name='protocol'>
<ref name='uint'/>
</element>
<optional>
<element name='description'>
<text/>
</element>
</optional>
</define>
<define name='capnet'>
<attribute name='type'>
<value>net</value>
</attribute>
<element name='interface'>
<text/>
</element>
<optional>
<element name='address'>
<ref name='mac'/>
</element>
</optional>
<zeroOrMore>
<ref name='subcapnet'/>
</zeroOrMore>
</define>
<define name='subcapnet'>
<element name='capability'>
<choice>
<ref name='subcapnet80203'/>
<ref name='subcapnet80211'/>
</choice>
</element>
</define>
<define name='subcapnet80203'>
<attribute name='type'>
<value>80203</value>
</attribute>
</define>
<define name='subcapnet80211'>
<attribute name='type'>
<value>80211</value>
</attribute>
</define>
<define name='capscsihost'>
<attribute name='type'>
<value>scsi_host</value>
</attribute>
<element name='host'>
<ref name='uint'/>
</element>
</define>
<define name='capscsi'>
<attribute name='type'>
<value>scsi</value>
</attribute>
<element name='host'>
<ref name='uint'/>
</element>
<element name='bus'>
<ref name='uint'/>
</element>
<element name='target'>
<ref name='uint'/>
</element>
<element name='lun'>
<ref name='uint'/>
</element>
<element name='type'>
<text/>
</element>
</define>
<define name='capstorage'>
<attribute name='type'>
<value>storage</value>
</attribute>
<element name='block'>
<ref name='path'/>
</element>
<optional>
<element name='bus'>
<text/>
</element>
</optional>
<optional>
<element name='drive_type'>
<text/>
</element>
</optional>
<optional>
<element name='model'>
<text/>
</element>
</optional>
<optional>
<element name='vendor'>
<text/>
</element>
</optional>
<choice>
<ref name='capstorageremoveable'/>
<ref name='capstoragefixed'/>
</choice>
<optional>
<element name='capability'>
<attribute name='type'>
<value>hotpluggable</value>
</attribute>
</element>
</optional>
</define>
<define name='capstorageremoveable'>
<element name='capability'>
<attribute name='type'>
<value>removable</value>
</attribute>
<element name='media_available'>
<choice>
<value>1</value>
<value>0</value>
</choice>
</element>
<element name='media_size'>
<ref name='uint'/>
</element>
</element>
</define>
<define name='capstoragefixed'>
<element name='size'>
<ref name='uint'/>
</element>
</define>
<define name='uuid'>
<choice>
<data type='string'>
<param name="pattern">[a-fA-F0-9]{32}</param>
</data>
<data type='string'>
<param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
</data>
</choice>
</define>
<define name='uint'>
<data type='string'>
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name='hexuint'>
<data type='string'>
<param name="pattern">(0x)?[0-9a-f]+</param>
</data>
</define>
<define name='mac'>
<data type='string'>
<param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
</data>
</define>
<define name='path'>
<data type='string'>
<param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
</data>
</define>
</grammar>
<!-- A Relax NG schema for the libvirt node device XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- We handle only document defining a domain -->
<start>
<ref name='pool'/>
</start>
<define name='pool'>
<element name='pool'>
<choice>
<ref name='pooldir'/>
<ref name='poolfs'/>
<ref name='poolnetfs'/>
<ref name='poollogical'/>
<ref name='pooldisk'/>
<ref name='pooliscsi'/>
<ref name='poolscsi'/>
</choice>
</element>
</define>
<define name='pooldir'>
<attribute name='type'>
<value>dir</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedir'/>
<ref name='target'/>
</define>
<define name='poolfs'>
<attribute name='type'>
<value>fs</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcefs'/>
<ref name='target'/>
</define>
<define name='poolnetfs'>
<attribute name='type'>
<value>netfs</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcenetfs'/>
<ref name='target'/>
</define>
<define name='poollogical'>
<attribute name='type'>
<value>logical</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcelogical'/>
<ref name='target'/>
</define>
<define name='pooldisk'>
<attribute name='type'>
<value>disk</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcedisk'/>
<ref name='target'/>
</define>
<define name='pooliscsi'>
<attribute name='type'>
<value>iscsi</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourceiscsi'/>
<ref name='target'/>
</define>
<define name='poolscsi'>
<attribute name='type'>
<value>scsi</value>
</attribute>
<ref name='commonmetadata'/>
<ref name='sizing'/>
<ref name='sourcescsi'/>
<ref name='target'/>
</define>
<define name='commonmetadata'>
<element name='name'>
<ref name='name'/>
</element>
<optional>
<element name='uuid'>
<ref name='uuid'/>
</element>
</optional>
</define>
<define name='sizing'>
<optional>
<element name='capacity'>
<ref name='uint'/>
</element>
</optional>
<optional>
<element name='allocation'>
<ref name='uint'/>
</element>
</optional>
<optional>
<element name='available'>
<ref name='uint'/>
</element>
</optional>
</define>
<define name='permissions'>
<optional>
<element name='permissions'>
<element name='mode'>
<ref name='uint'/>
</element>
<element name='owner'>
<ref name='uint'/>
</element>
<element name='group'>
<ref name='uint'/>
</element>
<optional>
<element name='label'>
<text/>
</element>
</optional>
</element>
</optional>
</define>
<define name='target'>
<element name='target'>
<optional>
<element name='path'>
<ref name='path'/>
</element>
</optional>
<ref name='permissions'/>
</element>
</define>
<define name='sourceinfohost'>
<element name='host'>
<attribute name='name'>
<text/>
</attribute>
<empty/>
</element>
</define>
<define name='sourceinfodev'>
<element name='device'>
<attribute name='path'>
<choice>
<ref name='path'/>
<ref name='name'/>
</choice>
</attribute>
<choice>
<empty/>
<ref name='devextents'/>
</choice>
</element>
</define>
<define name='devextents'>
<oneOrMore>
<element name='freeExtent'>
<attribute name='start'>
<ref name='uint'/>
</attribute>
<attribute name='end'>
<ref name='uint'/>
</attribute>
</element>
</oneOrMore>
</define>
<define name='sourceinfodir'>
<element name='dir'>
<attribute name='path'>
<ref name='path'/>
</attribute>
<empty/>
</element>
</define>
<define name='sourceinfoadapter'>
<element name='adapter'>
<attribute name='name'>
<text/>
</attribute>
<empty/>
</element>
</define>
<define name='sourceinfoname'>
<element name='name'>
<text/>
</element>
</define>
<define name='sourcefmtfs'>
<optional>
<element name='format'>
<attribute name='type'>
<choice>
<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>
</choice>
</attribute>
</element>
</optional>
</define>
<define name='sourcefmtnetfs'>
<optional>
<element name='format'>
<attribute name='type'>
<choice>
<value>auto</value>
<value>nfs</value>
</choice>
</attribute>
</element>
</optional>
</define>
<define name='sourcefmtdisk'>
<optional>
<element name='format'>
<attribute name='type'>
<choice>
<value>none</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>
</choice>
</attribute>
</element>
</optional>
</define>
<define name='sourcefmtlogical'>
<optional>
<element name='format'>
<attribute name='type'>
<choice>
<value>auto</value>
<value>lvm2</value>
</choice>
</attribute>
</element>
</optional>
</define>
<define name='sourcedir'>
<optional>
<element name='source'>
<empty/>
</element>
</optional>
</define>
<define name='sourcefs'>
<element name='source'>
<ref name='sourceinfodev'/>
<ref name='sourcefmtfs'/>
</element>
</define>
<define name='sourcenetfs'>
<element name='source'>
<ref name='sourceinfohost'/>
<ref name='sourceinfodir'/>
<ref name='sourcefmtnetfs'/>
</element>
</define>
<define name='sourcelogical'>
<element name='source'>
<ref name='sourceinfoname'/>
<optional>
<ref name='sourceinfodev'/>
</optional>
<ref name='sourcefmtlogical'/>
</element>
</define>
<define name='sourcedisk'>
<element name='source'>
<ref name='sourceinfodev'/>
<ref name='sourcefmtdisk'/>
</element>
</define>
<define name='sourceiscsi'>
<element name='source'>
<ref name='sourceinfohost'/>
<ref name='sourceinfodev'/>
</element>
</define>
<define name='sourcescsi'>
<element name='source'>
<ref name='sourceinfoname'/>
</element>
</define>
<define name='name'>
<data type='string'>
<param name="pattern">[a-zA-Z0-9_\+\-]+</param>
</data>
</define>
<define name='uuid'>
<choice>
<data type='string'>
<param name="pattern">[a-fA-F0-9]{32}</param>
</data>
<data type='string'>
<param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
</data>
</choice>
</define>
<define name='uint'>
<data type='string'>
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name='path'>
<data type='string'>
<param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
</data>
</define>
</grammar>
<!-- A Relax NG schema for the libvirt node device XML format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- We handle only document defining a domain -->
<start>
<ref name='vol'/>
</start>
<define name='vol'>
<element name='volume'>
<element name='name'>
<ref name='name'/>
</element>
<optional>
<element name='key'>
<text/>
</element>
</optional>
<ref name='source'/>
<ref name='sizing'/>
<ref name='target'/>
<optional>
<ref name='backingStore'/>
</optional>
</element>
</define>
<define name='sizing'>
<optional>
<element name='capacity'>
<ref name='uint'/>
</element>
</optional>
<optional>
<element name='allocation'>
<ref name='uint'/>
</element>
</optional>
</define>
<define name='permissions'>
<optional>
<element name='permissions'>
<element name='mode'>
<ref name='uint'/>
</element>
<element name='owner'>
<ref name='uint'/>
</element>
<element name='group'>
<ref name='uint'/>
</element>
<optional>
<element name='label'>
<text/>
</element>
</optional>
</element>
</optional>
</define>
<define name='target'>
<element name='target'>
<optional>
<element name='path'>
<ref name='path'/>
</element>
</optional>
<ref name='format'/>
<ref name='permissions'/>
</element>
</define>
<define name='backingStore'>
<element name='backingStore'>
<element name='path'>
<ref name='path'/>
</element>
<ref name='format'/>
<ref name='permissions'/>
</element>
</define>
<define name='source'>
<element name='source'>
<zeroOrMore>
<ref name='sourcedev'/>
</zeroOrMore>
</element>
</define>
<define name='sourcedev'>
<element name='device'>
<attribute name='path'>
<ref name='path'/>
</attribute>
<choice>
<empty/>
<ref name='devextents'/>
</choice>
</element>
</define>
<define name='devextents'>
<oneOrMore>
<element name='extent'>
<attribute name='start'>
<ref name='uint'/>
</attribute>
<attribute name='end'>
<ref name='uint'/>
</attribute>
</element>
</oneOrMore>
</define>
<define name='formatdev'>
<choice>
<value>none</value>
<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>
</choice>
</define>
<define name='formatfile'>
<choice>
<value>raw</value>
<value>dir</value>
<value>bochs</value>
<value>cloop</value>
<value>cow</value>
<value>dmg</value>
<value>iso</value>
<value>qcow</value>
<value>qcow2</value>
<value>vmdk</value>
<value>vpc</value>
</choice>
</define>
<define name='format'>
<optional>
<element name='format'>
<attribute name='type'>
<choice>
<ref name='formatfile'/>
<ref name='formatdev'/>
</choice>
</attribute>
</element>
</optional>
</define>
<define name='name'>
<data type='string'>
<param name="pattern">[a-zA-Z0-9_\+\-\.]+</param>
</data>
</define>
<define name='uint'>
<data type='string'>
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name='path'>
<data type='string'>
<param name="pattern">/[a-zA-Z0-9_\+\-\./%]+</param>
</data>
</define>
</grammar>
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
<capabilities>
<host>
<cpu>
<arch>i686</arch>
</cpu>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/bin/qemu-kvm</emulator>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
</arch>
<features>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mips'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mipsel'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mipsel</emulator>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='sparc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<machine>sun4m</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='ppc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<machine>g3bw</machine>
<machine>mac99</machine>
<machine>prep</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/xenner</emulator>
<machine>xenner</machine>
<domain type='kvm'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
</capabilities>
<capabilities>
<host>
<cpu>
<arch>i686</arch>
<features>
<pae/>
<nonpae/>
</features>
</cpu>
<topology>
<cells num='2'>
<cell id='0'>
<cpus num='8'>
<cpu id='0'/>
<cpu id='2'/>
<cpu id='4'/>
<cpu id='6'/>
<cpu id='8'/>
<cpu id='10'/>
<cpu id='12'/>
<cpu id='14'/>
</cpus>
</cell>
<cell id='1'>
<cpus num='8'>
<cpu id='1'/>
<cpu id='3'/>
<cpu id='5'/>
<cpu id='7'/>
<cpu id='9'/>
<cpu id='11'/>
<cpu id='13'/>
<cpu id='15'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/test-hv</emulator>
<domain type='test'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
</features>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/test-hv</emulator>
<domain type='test'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
</features>
</guest>
</capabilities>
#!/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
#!/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"
......
#!/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
<device>
<name>DVD_GCC_4247N</name>
<parent>pci_8086_27df_scsi_host_scsi_device_lun0</parent>
<capability type='storage'>
<block>/dev/sr0</block>
<bus>scsi</bus>
<drive_type>cdrom</drive_type>
<model>RW/DVD GCC-4247N</model>
<vendor>HL-DT-ST</vendor>
<capability type='removable'>
<media_available>0</media_available>
<media_size>0</media_size>
</capability>
</capability>
</device>
<device>
<name>computer</name>
<capability type='system'>
<hardware>
<vendor>LENOVO</vendor>
<version>ThinkPad T60p</version>
<serial>123123</serial>
<uuid>12345678-1234-1234-9596-a088b277d677</uuid>
</hardware>
<firmware>
<vendor>LENOVO</vendor>
<version>79ETE1WW (2.21 )</version>
<release_date>02/05/2008</release_date>
</firmware>
</capability>
</device>
<device>
<name>net_00_13_02_b9_f9_d3</name>
<parent>pci_8086_4227</parent>
<capability type='net'>
<interface>eth0</interface>
<address>00:13:02:b9:f9:d3</address>
<capability type='80211'/>
</capability>
</device>
<device>
<name>net_00_15_58_2f_e9_55</name>
<parent>pci_8086_109a</parent>
<capability type='net'>
<interface>eth1</interface>
<address>00:15:58:2f:e9:55</address>
<capability type='80203'/>
</capability>
</device>
<device>
<name>pci_1002_71c4</name>
<parent>pci_8086_27a1</parent>
<capability type='pci'>
<domain>0</domain>
<bus>1</bus>
<slot>0</slot>
<function>0</function>
<product id='0x71c4'>M56GL [Mobility FireGL V5200]</product>
<vendor id='0x1002'>ATI Technologies Inc</vendor>
</capability>
</device>
<device>
<name>pci_8086_27c5_scsi_host</name>
<parent>pci_8086_27c5</parent>
<capability type='scsi_host'>
<host>0</host>
</capability>
</device>
<device>
<name>pci_8086_27c5_scsi_host_0</name>
<parent>pci_8086_27c5</parent>
<capability type='scsi_host'>
<host>1</host>
</capability>
</device>
<device>
<name>pci_8086_27c5_scsi_host_scsi_device_lun0</name>
<parent>pci_8086_27c5_scsi_host</parent>
<capability type='scsi'>
<host>0</host>
<bus>0</bus>
<target>0</target>
<lun>0</lun>
<type>disk</type>
</capability>
</device>
<device>
<name>pci_8086_27c5_scsi_host_scsi_host</name>
<parent>pci_8086_27c5_scsi_host</parent>
<capability type='scsi_host'>
<host>0</host>
</capability>
</device>
<device>
<name>storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE</name>
<parent>pci_8086_27c5_scsi_host_scsi_device_lun0</parent>
<capability type='storage'>
<block>/dev/sda</block>
<bus>scsi</bus>
<drive_type>disk</drive_type>
<model>HTS721010G9SA00</model>
<vendor>ATA</vendor>
<size>100030242816</size>
</capability>
</device>
<device>
<name>usb_device_1d6b_1_0000_00_1d_0</name>
<parent>pci_8086_27c8</parent>
<capability type='usb_device'>
<bus>2</bus>
<device>1</device>
<product id='0x0001'>1.1 root hub</product>
<vendor id='0x1d6b'>Linux Foundation</vendor>
</capability>
</device>
<device>
<name>usb_device_1d6b_1_0000_00_1d_0_if0</name>
<parent>usb_device_1d6b_1_0000_00_1d_0</parent>
<capability type='usb'>
<number>0</number>
<class>9</class>
<subclass>0</subclass>
<protocol>0</protocol>
</capability>
</device>
#!/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
<pool type='dir'>
<name>virtimages</name>
<uuid>70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2</uuid>
<capacity>0</capacity>
<allocation>0</allocation>
<available>0</available>
<source>
</source>
<target>
<path>/var/lib/libvirt/images</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
<pool type='disk'>
<name>sda</name>
<uuid>e3509a62-1b4c-e20b-94bd-9168963f9b97</uuid>
<capacity>100027630080</capacity>
<allocation>100027597824</allocation>
<available>0</available>
<source>
<device path='/dev/sda'>
<freeExtent start='370137600' end='567544320'/>
<freeExtent start='987033600' end='1044610560'/>
</device>
<format type='dos'/>
</source>
<target>
<path>/dev</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
<pool type='fs'>
<name>images</name>
<uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
<capacity>0</capacity>
<allocation>0</allocation>
<available>0</available>
<source>
<device path='/dev/sda6'/>
<format type='ext3'/>
</source>
<target>
<path>/mnt</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
<pool type='iscsi'>
<name>virtimages</name>
<source>
<host name="iscsi.example.com"/>
<device path="demo-target"/>
</source>
<target>
<path>/dev/disk/by-path</path>
</target>
</pool>
<pool type='logical'>
<name>HostVG</name>
<uuid>1c13165a-d0f4-3aee-b447-30fb38789091</uuid>
<capacity>99891544064</capacity>
<allocation>99220455424</allocation>
<available>671088640</available>
<source>
<name>HostVG</name>
<format type='lvm2'/>
</source>
<target>
<path>/dev/HostVG</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
<pool type='netfs'>
<name>nfsimages</name>
<uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
<capacity>0</capacity>
<allocation>0</allocation>
<available>0</available>
<source>
<host name='localhost'/>
<dir path='/var/lib/libvirt/images'/>
<format type='nfs'/>
</source>
<target>
<path>/mnt</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
#!/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
<volume>
<name>Swap</name>
<key>r4xkCv-MQhr-WKIT-R66x-Epn2-e8hG-1Z5gY0</key>
<source>
<device path='/dev/sda2'>
<extent start='31440502784' end='33520877568'/>
</device>
</source>
<capacity>2080374784</capacity>
<allocation>2080374784</allocation>
<target>
<path>/dev/HostVG/Swap</path>
<permissions>
<mode>060660</mode>
<owner>0</owner>
<group>6</group>
<label>system_u:object_r:fixed_disk_device_t:s0</label>
</permissions>
</target>
</volume>
<volume>
<name>sda1</name>
<key>/dev/sda1</key>
<source>
<device path='/dev/sda'>
<extent start='32256' end='106928640'/>
</device>
</source>
<capacity>106896384</capacity>
<allocation>106896384</allocation>
<target>
<path>/dev/sda1</path>
<format type='none'/>
<permissions>
<mode>060660</mode>
<owner>0</owner>
<group>6</group>
<label>system_u:object_r:fixed_disk_device_t:s0</label>
</permissions>
</target>
</volume>
<volume>
<name>OtherDemo.img</name>
<key>/var/lib/libvirt/images/OtherDemo.img</key>
<source>
</source>
<capacity>5242880000</capacity>
<allocation>294912</allocation>
<target>
<path>/var/lib/libvirt/images/OtherDemo.img</path>
<format type='qcow2'/>
<permissions>
<mode>0100644</mode>
<owner>0</owner>
<group>0</group>
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
</target>
<backingStore>
<path>/var/lib/libvirt/images/BaseDemo.img</path>
<format type='raw'/>
<permissions>
<mode>0100644</mode>
<owner>0</owner>
<group>0</group>
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
</backingStore>
</volume>
#!/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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册