We currently only have RNG schemas for the domain XML and network XML. This patch adds more RNG schemas covering the host capabilities XML, the storage pool and storage volume XML and node device XML In addition it sets up the makefile to install all these schemas into /usr/share/libvirt/schemas/, instead if just randomly stuffing them into RPM %docs section Finally, test cases and example XML files are added to check correctness of the schemas and XML a/docs/libvirt.rng | 1111 ---------- a/docs/network.rng | 69 b/docs/schemas/Makefile.am | 12 b/docs/schemas/capability.rng | 287 ++ b/docs/schemas/domain.rng | 1111 ++++++++++ b/docs/schemas/network.rng | 69 b/docs/schemas/nodedev.rng | 360 +++ b/docs/schemas/storagepool.rng | 371 +++ b/docs/schemas/storagevol.rng | 187 + b/tests/capabilityschemadata/caps-qemu-kvm.xml | 111 b/tests/capabilityschemadata/caps-test.xml | 71 b/tests/capabilityschematest | 34 b/tests/networkschematest | 33 b/tests/nodedevschemadata/DVD_GCC_4247N.xml | 17 b/tests/nodedevschemadata/computer.xml | 18 b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml | 11 b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml | 11 b/tests/nodedevschemadata/pci_1002_71c4.xml | 14 b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml | 9 b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml | 9 b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml | 13 b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml | 9 b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 14 b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml | 12 b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml | 12 b/tests/nodedevschematest | 33 b/tests/storagepoolschemadata/pool-dir.xml | 17 b/tests/storagepoolschemadata/pool-disk.xml | 22 b/tests/storagepoolschemadata/pool-fs.xml | 20 b/tests/storagepoolschemadata/pool-iscsi.xml | 10 b/tests/storagepoolschemadata/pool-logical.xml | 19 b/tests/storagepoolschemadata/pool-netfs.xml | 21 b/tests/storagepoolschematest | 33 b/tests/storagevolschemadata/vol-logical.xml | 21 b/tests/storagevolschemadata/vol-partition.xml | 21 b/tests/storagevolschemadata/vol-qcow2.xml | 28 b/tests/storagevolschematest | 33 configure.in | 1 docs/Makefile.am | 8 libvirt.spec.in | 11 mingw32-libvirt.spec.in | 9 tests/Makefile.am | 20 tests/domainschematest | 3 43 files changed, 3115 insertions(+), 1190 deletions(-) Daniel diff -r 8eb4d4028b98 configure.in --- a/configure.in Wed Jan 21 15:47:23 2009 +0000 +++ b/configure.in Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 docs/Makefile.am --- a/docs/Makefile.am Wed Jan 21 15:47:23 2009 +0000 +++ b/docs/Makefile.am Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 docs/libvirt.rng --- a/docs/libvirt.rng Wed Jan 21 15:47:23 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1111 +0,0 @@ -<?xml version="1.0" ?> -<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='domain'/> - </start> - - <!-- - We handle only document defining a domain - --> - <define name='domain'> - <element name="domain"> - <ref name='hvs'/> - <ref name='ids'/> - <interleave> - <ref name='os'/> - <ref name='clock'/> - <ref name='resources'/> - <ref name='features'/> - <ref name='termination'/> - <optional> - <ref name='devices'/> - </optional> - </interleave> - </element> - </define> - - <define name='hvs'> - <attribute name='type'> - <choice> - <value>xen</value> - <value>kvm</value> - <value>kqemu</value> - <value>qemu</value> - <value>lxc</value> - <value>openvz</value> - <value>test</value> - </choice> - </attribute> - </define> - - <define name='os'> - <choice> - <ref name='osxen'/> - <ref name='oshvm'/> - <ref name='osexe'/> - </choice> - </define> - - <define name='osxen'> - <choice> - <group> - <optional> - <ref name='bootloader'/> - </optional> - <element name='os'> - <ref name='ostypexen'/> - <ref name='osbootkernel'/> - </element> - </group> - <group> - <ref name='bootloader'/> - <optional> - <element name='os'> - <ref name='ostypexen'/> - <optional> - <ref name='osbootkernel'/> - </optional> - </element> - </optional> - </group> - </choice> - </define> - - - <define name='oshvm'> - <element name='os'> - <ref name='ostypehvm'/> - <interleave> - <optional> - <element name='loader'> - <ref name='absFilePath'/> - </element> - </optional> - <choice> - <ref name='osbootkernel'/> - <ref name='osbootdev'/> - </choice> - </interleave> - </element> - </define> - - - <define name='ostypexen'> - <element name='type'> - <optional> - <attribute name='arch'> - <choice> - <value>i686</value> - <value>x86_64</value> - <value>ia64</value> - </choice> - </attribute> - </optional> - <optional> - <attribute name='machine'> - <choice> - <value>xenpv</value> - <value>xenner</value> - </choice> - </attribute> - </optional> - <choice> - <value>xen</value> - <value>linux</value> - </choice> - </element> - </define> - - <define name='ostypehvm'> - <element name='type'> - <optional> - <choice> - <ref name='hvmx86'/> - <ref name='hvmmips'/> - <ref name='hvmsparc'/> - <ref name='hvmppc'/> - </choice> - </optional> - <value>hvm</value> - </element> - </define> - - <define name='hvmx86'> - <group> - <attribute name='arch'> - <choice> - <value>i686</value> - <value>x86_64</value> - </choice> - </attribute> - <attribute name='machine'> - <choice> - <value>xenfv</value> - <value>pc</value> - <value>isapc</value> - </choice> - </attribute> - </group> - </define> - - <define name='hvmmips'> - <group> - <attribute name='arch'> - <value>mips</value> - </attribute> - <attribute name='machine'> - <value>mips</value> - </attribute> - </group> - </define> - - <define name='hvmsparc'> - <group> - <attribute name='arch'> - <value>sparc</value> - </attribute> - <attribute name='machine'> - <value>sun4m</value> - </attribute> - </group> - </define> - - <define name='hvmppc'> - <group> - <attribute name='arch'> - <value>ppc</value> - </attribute> - <attribute name='machine'> - <choice> - <value>g3bw</value> - <value>mac99</value> - <value>prep</value> - </choice> - </attribute> - </group> - </define> - - - <define name='osexe'> - <element name='os'> - <element name='type'> - <value>exe</value> - </element> - <interleave> - <optional> - <element name='init'> - <ref name='absFilePath'/> - </element> - </optional> - </interleave> - </element> - </define> - - - - <!-- - The Identifiers can be: - - an optional id attribute with a number on the domain element - - a mandatory name - - an optional uuid - --> - <define name='ids'> - <optional> - <attribute name='id'> - <ref name='unsignedInt'/> - </attribute> - </optional> - <interleave> - <element name="name"> - <ref name='domainName'/> - </element> - <optional> - <element name="uuid"> - <ref name='UUID'/> - </element> - </optional> - </interleave> - </define> - - <!-- - Resources usage defines the amount of memory (maximum and possibly - current usage) and number of virtual CPUs used by that domain. - We can't check here the rule that currentMemory <= memory - --> - - <define name='resources'> - <interleave> - <element name='memory'> - <ref name='memoryKB'/> - </element> - <optional> - <element name='currentMemory'> - <ref name='memoryKB'/> - </element> - </optional> - <optional> - <element name='vcpu'> - <optional> - <attribute name='cpuset' /> - </optional> - <ref name='countCPU'/> - </element> - </optional> - </interleave> - </define> - - <define name='clock'> - <optional> - <element name='clock'> - <attribute name='offset'> - <choice> - <value>localtime</value> - <value>utc</value> - </choice> - </attribute> - <empty/> - </element> - </optional> - </define> - - <!-- - A bootloader may be used to extract the OS information instead of - defining the OS parameter in the instance. It points just to the - binary or script used to extract the data from the first disk device. - --> - <define name='bootloader'> - <interleave> - <element name='bootloader'> - <choice> - <ref name='absFilePath'/> - <empty/> - </choice> - </element> - <optional> - <element name='bootloader_args'> - <text/> - </element> - </optional> - </interleave> - </define> - - <define name='osbootkernel'> - <interleave> - <element name='kernel'> - <ref name='absFilePath'/> - </element> - <optional> - <element name='initrd'> - <ref name='absFilePath'/> - </element> - </optional> - <optional> - <element name='root'> - <ref name='devicePath'/> - </element> - </optional> - <optional> - <element name='cmdline'> - <text/> - </element> - </optional> - </interleave> - </define> - - <define name='osbootdev'> - <element name='boot'> - <attribute name='dev'> - <choice> - <value>hd</value> - <value>fd</value> - <value>cdrom</value> - <value>network</value> - </choice> - </attribute> - <empty/> - </element> - </define> - - - <define name='diskspec'> - <optional> - <ref name='driver'/> - </optional> - <ref name='target'/> - <optional> - <element name='readonly'> - <empty/> - </element> - </optional> - <optional> - <element name='shareable'> - <empty/> - </element> - </optional> - </define> - - <!-- - A disk description can be either of type file or block - The name of the attribute on the source element depends on the type - - --> - <define name='disk'> - <element name='disk'> - <optional> - <attribute name='device'> - <choice> - <value>floppy</value> - <value>disk</value> - <value>cdrom</value> - </choice> - </attribute> - </optional> - <choice> - <group> - <attribute name='type'> - <value>file</value> - </attribute> - <interleave> - <optional> - <element name='source'> - <attribute name='file'> - <ref name='absFilePath'/> - </attribute> - <empty/> - </element> - </optional> - <ref name='diskspec'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>block</value> - </attribute> - <interleave> - <optional> - <element name='source'> - <attribute name='dev'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - </optional> - <ref name='diskspec'/> - </interleave> - </group> - <ref name='diskspec'/> - </choice> - </element> - </define> - - <define name='target'> - <element name='target'> - <attribute name='dev'> - <ref name='deviceName'/> - </attribute> - <optional> - <attribute name='bus'> - <choice> - <value>ide</value> - <value>virtio</value> - <value>fdc</value> - <value>xen</value> - <value>usb</value> - </choice> - </attribute> - </optional> - </element> - </define> - - <!-- - Disk may use a special driver for access. Currently this is - only defined for Xen for tap/aio and file, but will certainly be - extended in the future, and libvirt doesn't look for specific values. - --> - <define name='driver'> - <element name='driver'> - <attribute name='name'> - <ref name='genericName'/> - </attribute> - <optional> - <attribute name='type'> - <ref name='genericName'/> - </attribute> - </optional> - <empty/> - </element> - </define> - - <define name='filesystem'> - <element name='filesystem'> - <choice> - <group> - <attribute name='type'> - <value>file</value> - </attribute> - <interleave> - <element name='source'> - <attribute name='file'> - <ref name='absFilePath'/> - </attribute> - <empty/> - </element> - <ref name='filesystemtgt'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>block</value> - </attribute> - <interleave> - <element name='source'> - <attribute name='dev'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - <ref name='filesystemtgt'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>mount</value> - </attribute> - <interleave> - <element name='source'> - <attribute name='dir'> - <ref name='absFilePath'/> - </attribute> - <empty/> - </element> - <ref name='filesystemtgt'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>template</value> - </attribute> - <interleave> - <element name='source'> - <attribute name='name'> - <ref name='genericName'/> - </attribute> - <empty/> - </element> - <ref name='filesystemtgt'/> - </interleave> - </group> - </choice> - </element> - </define> - - <define name='filesystemtgt'> - <element name='target'> - <attribute name='dir'> - <ref name='absDirPath'/> - </attribute> - <empty/> - </element> - </define> - - <!-- - An interface description can either be of type bridge in which case - it will use a bridging source, or of type ethernet which uses a device - source and a device target instead. They both share a set of interface - options. FIXME - --> - <define name='interface'> - <element name='interface'> - <choice> - <group> - <attribute name='type'> - <value>bridge</value> - </attribute> - <interleave> - <optional> - <element name='source'> - <attribute name='bridge'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - </optional> - <ref name='interface-options'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>ethernet</value> - </attribute> - <interleave> - <optional> - <element name='source'> - <attribute name='dev'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - </optional> - <ref name='interface-options'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>network</value> - </attribute> - <interleave> - <element name='source'> - <attribute name='network'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - <ref name='interface-options'/> - </interleave> - </group> - <group> - <attribute name='type'> - <value>user</value> - </attribute> - <interleave> - <ref name='interface-options'/> - </interleave> - </group> - </choice> - </element> - </define> - - <!-- - The interface options possible are: - - the MAC address - - the IP address bound to the interface - - the name of the script used to set up the binding - - the target device used - --> - <define name='interface-options'> - <interleave> - <optional> - <element name='target'> - <attribute name='dev'> - <ref name='deviceName'/> - </attribute> - <empty/> - </element> - </optional> - <optional> - <element name='mac'> - <attribute name='address'> - <ref name='addrMAC'/> - </attribute> - <empty/> - </element> - </optional> - <optional> - <element name='ip'> - <attribute name='address'> - <ref name='addrIP'/> - </attribute> - <empty/> - </element> - </optional> - <optional> - <element name='script'> - <attribute name='path'> - <ref name='filePath'/> - </attribute> - <empty/> - </element> - </optional> - <optional> - <element name='model'> - <attribute name='type' /> - <empty/> - </element> - </optional> - </interleave> - </define> - - <!-- - An emulator description is just a path to the binary used for the task - --> - <define name='emulator'> - <element name='emulator'> - <ref name='absFilePath'/> - </element> - </define> - - <!-- - A graphic description, currently in Xen only 2 types are supported: - - sdl with optional display, xauth and fullscreen - - vnc with a required port and optional listen IP address, password - and keymap - --> - <define name='graphic'> - <element name='graphics'> - <choice> - <group> - <attribute name='type'> - <value>sdl</value> - </attribute> - <optional> - <attribute name='display'> - <text/> - </attribute> - </optional> - <optional> - <attribute name='xauth'> - <text/> - </attribute> - </optional> - <optional> - <attribute name='fullscreen'> - <choice> - <value>yes</value> - <value>no</value> - </choice> - </attribute> - </optional> - </group> - <group> - <attribute name='type'> - <value>vnc</value> - </attribute> - <optional> - <attribute name='port'> - <ref name='PortNumber'/> - </attribute> - </optional> - <optional> - <attribute name='autoport'> - <choice> - <value>yes</value> - <value>no</value> - </choice> - </attribute> - </optional> - <optional> - <attribute name='listen'> - <ref name='addrIP'/> - </attribute> - </optional> - <optional> - <attribute name='passwd'> - <text/> - </attribute> - </optional> - <optional> - <attribute name='keymap'> - <text/> - </attribute> - </optional> - </group> - </choice> - </element> - </define> - - <!-- - When a domain terminates multiple policies can be applied depending - on how it ended: - --> - <define name='termination'> - <interleave> - <optional> - <element name='on_reboot'> - <ref name='offOptions'/> - </element> - </optional> - <optional> - <element name='on_poweroff'> - <ref name='offOptions'/> - </element> - </optional> - <optional> - <element name='on_crash'> - <ref name='offOptions'/> - </element> - </optional> - </interleave> - </define> - - <!-- - Options when a domain terminates: - destroy: The domain is cleaned up - restart: A new domain is started in place of the old one - preserve: The domain will remain in memory until it is destroyed manually - rename-restart: a variant of the previous one but where the old domain is - renamed before being saved to allow a restart - --> - <define name='offOptions'> - <choice> - <value>destroy</value> - <value>restart</value> - <value>preserve</value> - <value>rename-restart</value> - </choice> - </define> - - <!-- - Specific setup for a qemu emulated character device. Note: this - definition doesn't fully specify the constraints on this node. - --> - <define name='qemucdev'> - <attribute name='type'> - <choice> - <value>dev</value> - <value>file</value> - <value>pipe</value> - <value>unix</value> - <value>tcp</value> - <value>udp</value> - <value>null</value> - <value>stdio</value> - <value>vc</value> - <value>pty</value> - </choice> - </attribute> - - <interleave> - <optional> - <oneOrMore> - <element name='source'> - <optional> - <attribute name='mode' /> - </optional> - <optional> - <attribute name='path' /> - </optional> - <optional> - <attribute name='host' /> - </optional> - <optional> - <attribute name='service' /> - </optional> - <optional> - <attribute name='wiremode' /> - </optional> - </element> - </oneOrMore> - </optional> - <optional> - <element name='protocol'> - <optional> - <attribute name='type' /> - </optional> - </element> - </optional> - <optional> - <element name='target'> - <optional> - <attribute name='port' /> - </optional> - </element> - </optional> - </interleave> - </define> - - <!-- - The description for a console - just a tty device - --> - <define name='console'> - <element name='console'> - <choice> - <group> - <optional> - <attribute name='tty'> - <ref name='devicePath'/> - </attribute> - </optional> - <empty/> - </group> - <ref name='qemucdev' /> - </choice> - </element> - </define> - - <define name='sound'> - <element name='sound'> - <attribute name='model'> - <choice> - <value>sb16</value> - <value>es1370</value> - <value>pcspk</value> - </choice> - </attribute> - </element> - </define> - - <define name='parallel'> - <element name='parallel'> - <ref name='qemucdev' /> - </element> - </define> - - <define name='serial'> - <element name='serial'> - <ref name='qemucdev' /> - </element> - </define> - - <define name='input'> - <element name='input'> - <attribute name='type'> - <choice> - <value>tablet</value> - <value>mouse</value> - </choice> - </attribute> - <optional> - <attribute name='bus'> - <choice> - <value>ps2</value> - <value>usb</value> - <value>xen</value> - </choice> - </attribute> - </optional> - </element> - </define> - - <define name='hostdev'> - <element name='hostdev'> - <optional> - <attribute name='mode'> - <choice> - <value>subsystem</value> - <value>capabilities</value> - </choice> - </attribute> - <attribute name='type'> - <choice> - <value>usb</value> - <value>pci</value> - </choice> - </attribute> - </optional> - <group> - <element name='source'> - <choice> - <ref name="usbproduct"/> - <ref name="usbaddress"/> - <ref name="pciaddress"/> - </choice> - </element> - </group> - </element> - </define> - - <define name="usbproduct"> - <element name="vendor"> - <attribute name="id"> - <ref name="usbId"/> - </attribute> - </element> - <element name="product"> - <attribute name="id"> - <ref name="usbId"/> - </attribute> - </element> - </define> - - <define name="usbaddress"> - <element name="address"> - <attribute name="bus"> - <ref name="usbAddr"/> - </attribute> - <attribute name="device"> - <ref name="usbAddr"/> - </attribute> - </element> - </define> - - <define name="pciaddress"> - <element name="address"> - <optional> - <attribute name="domain"> - <ref name="pciDomain"/> - </attribute> - </optional> - <attribute name="bus"> - <ref name="pciBus"/> - </attribute> - <attribute name="slot"> - <ref name="pciSlot"/> - </attribute> - <attribute name="function"> - <ref name="pciFunc"/> - </attribute> - </element> - </define> - <!-- - Devices attached to a domain. - --> - <define name='devices'> - <element name='devices'> - <interleave> - <optional> - <ref name='emulator'/> - </optional> - <zeroOrMore> - <choice> - <ref name='graphic'/> - <ref name='disk'/> - <ref name='filesystem'/> - <ref name='interface'/> - <ref name='console'/> - <ref name='sound'/> - <ref name='parallel'/> - <ref name='serial'/> - <ref name='input'/> - <ref name='hostdev'/> - </choice> - </zeroOrMore> - </interleave> - </element> - </define> - - <!-- - A set of optional features: PAE, APIC and ACPI support - --> - <define name='features'> - <optional> - <element name="features"> - <interleave> - <optional> - <element name="pae"> - <empty/> - </element> - </optional> - <optional> - <element name="apic"> - <empty/> - </element> - </optional> - <optional> - <element name="acpi"> - <empty/> - </element> - </optional> - </interleave> - </element> - </optional> - </define> - - <!-- - Type library - - Our unsignedInt doesn't allow a leading '+' in its lexical form - A domain name shoul be made of ascii, numbers, _-+ and is non-empty - UUID currently allows only the 32 characters strict syntax - memoryKB request at least 4Mbytes though Xen will grow bigger if too low - --> - <define name='unsignedInt'> - <data type='unsignedInt'> - <param name="pattern">[0-9]+</param> - </data> - </define> - <define name='countCPU'> - <data type='unsignedShort'> - <param name="pattern">[0-9]+</param> - <param name="minInclusive">1</param> - </data> - </define> - <define name='PortNumber'> - <data type='short'> - <param name="minInclusive">-1</param> - </data> - </define> - <define name='memoryKB'> - <data type='unsignedInt'> - <param name="pattern">[0-9]+</param> - <param name="minInclusive">4000</param> - </data> - </define> - <define name='domainName'> - <data type='string'> - <param name="pattern">[A-Za-z0-9_\.\+\-&:/]+</param> - </data> - </define> - <define name='genericName'> - <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='filePath'> - <data type='string'> - <param name="pattern">[a-zA-Z0-9_\.\+\-&/%]+</param> - </data> - </define> - <define name='absFilePath'> - <data type='string'> - <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]+</param> - </data> - </define> - <define name='absDirPath'> - <data type='string'> - <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]*</param> - </data> - </define> - <define name='devicePath'> - <data type='string'> - <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param> - </data> - </define> - <define name='deviceName'> - <data type='string'> - <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param> - </data> - </define> - <define name='addrMAC'> - <data type='string'> - <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param> - </data> - </define> - <define name='addrIP'> - <data type='string'> - <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param> - </data> - </define> - <define name='usbId'> - <data type='string'> - <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param> - </data> - </define> - <define name='usbAddr'> - <data type='string'> - <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param> - </data> - </define> - <define name='pciDomain'> - <data type='string'> - <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param> - </data> - </define> - <define name='pciBus'> - <data type='string'> - <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param> - </data> - </define> - <define name='pciSlot'> - <data type='string'> - <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param> - </data> - </define> - <define name='pciFunc'> - <data type='string'> - <param name="pattern">(0x)?[0-7]</param> - </data> - </define> -</grammar> diff -r 8eb4d4028b98 docs/network.rng --- a/docs/network.rng Wed Jan 21 15:47:23 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -<!-- A Relax NG schema for the libvirt network XML format --> -<element name="network" xmlns="http://relaxng.org/ns/structure/1.0" - datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> - <!-- The name of the network, used to refer to it through the API - and in virsh --> - <element name="name"><text/></element> - <optional> - <element name="uuid"><text/></element> - </optional> - <optional> - <!-- The name of the network to be set up; this will back - the network on the host --> - <element name="bridge"> - <optional> - <attribute name="name"><text/></attribute> - </optional> - <optional> - <attribute name="stp"> - <choice> - <value>on</value> - <value>off</value> - </choice> - </attribute> - </optional> - <optional> - <attribute name="delay"><data type="integer"/></attribute> - </optional> - </element> - </optional> - <optional> - <!-- The IP element sets up NAT'ing and an optional DHCP server - local to the host. --> - <!-- FIXME: address, netmask and the start and end of the ranges - are IP addresses, and should be validated as such in the scheme --> - <element name="ip"> - <optional> - <attribute name="address"><text/></attribute> - </optional> - <optional> - <attribute name="netmask"><text/></attribute> - </optional> - <!-- Define the range(s) of IP addresses that the DHCP - server should hand out --> - <element name="dhcp"> - <zeroOrMore> - <element name="range"> - <attribute name="start"><text/></attribute> - <attribute name="end"><text/></attribute> - </element> - </zeroOrMore> - </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> diff -r 8eb4d4028b98 docs/schemas/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/Makefile.am Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 docs/schemas/capability.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/capability.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,287 @@ +<!-- 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> + diff -r 8eb4d4028b98 docs/schemas/domain.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/domain.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,1111 @@ +<?xml version="1.0" ?> +<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='domain'/> + </start> + + <!-- + We handle only document defining a domain + --> + <define name='domain'> + <element name="domain"> + <ref name='hvs'/> + <ref name='ids'/> + <interleave> + <ref name='os'/> + <ref name='clock'/> + <ref name='resources'/> + <ref name='features'/> + <ref name='termination'/> + <optional> + <ref name='devices'/> + </optional> + </interleave> + </element> + </define> + + <define name='hvs'> + <attribute name='type'> + <choice> + <value>xen</value> + <value>kvm</value> + <value>kqemu</value> + <value>qemu</value> + <value>lxc</value> + <value>openvz</value> + <value>test</value> + </choice> + </attribute> + </define> + + <define name='os'> + <choice> + <ref name='osxen'/> + <ref name='oshvm'/> + <ref name='osexe'/> + </choice> + </define> + + <define name='osxen'> + <choice> + <group> + <optional> + <ref name='bootloader'/> + </optional> + <element name='os'> + <ref name='ostypexen'/> + <ref name='osbootkernel'/> + </element> + </group> + <group> + <ref name='bootloader'/> + <optional> + <element name='os'> + <ref name='ostypexen'/> + <optional> + <ref name='osbootkernel'/> + </optional> + </element> + </optional> + </group> + </choice> + </define> + + + <define name='oshvm'> + <element name='os'> + <ref name='ostypehvm'/> + <interleave> + <optional> + <element name='loader'> + <ref name='absFilePath'/> + </element> + </optional> + <choice> + <ref name='osbootkernel'/> + <ref name='osbootdev'/> + </choice> + </interleave> + </element> + </define> + + + <define name='ostypexen'> + <element name='type'> + <optional> + <attribute name='arch'> + <choice> + <value>i686</value> + <value>x86_64</value> + <value>ia64</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name='machine'> + <choice> + <value>xenpv</value> + <value>xenner</value> + </choice> + </attribute> + </optional> + <choice> + <value>xen</value> + <value>linux</value> + </choice> + </element> + </define> + + <define name='ostypehvm'> + <element name='type'> + <optional> + <choice> + <ref name='hvmx86'/> + <ref name='hvmmips'/> + <ref name='hvmsparc'/> + <ref name='hvmppc'/> + </choice> + </optional> + <value>hvm</value> + </element> + </define> + + <define name='hvmx86'> + <group> + <attribute name='arch'> + <choice> + <value>i686</value> + <value>x86_64</value> + </choice> + </attribute> + <attribute name='machine'> + <choice> + <value>xenfv</value> + <value>pc</value> + <value>isapc</value> + </choice> + </attribute> + </group> + </define> + + <define name='hvmmips'> + <group> + <attribute name='arch'> + <value>mips</value> + </attribute> + <attribute name='machine'> + <value>mips</value> + </attribute> + </group> + </define> + + <define name='hvmsparc'> + <group> + <attribute name='arch'> + <value>sparc</value> + </attribute> + <attribute name='machine'> + <value>sun4m</value> + </attribute> + </group> + </define> + + <define name='hvmppc'> + <group> + <attribute name='arch'> + <value>ppc</value> + </attribute> + <attribute name='machine'> + <choice> + <value>g3bw</value> + <value>mac99</value> + <value>prep</value> + </choice> + </attribute> + </group> + </define> + + + <define name='osexe'> + <element name='os'> + <element name='type'> + <value>exe</value> + </element> + <interleave> + <optional> + <element name='init'> + <ref name='absFilePath'/> + </element> + </optional> + </interleave> + </element> + </define> + + + + <!-- + The Identifiers can be: + - an optional id attribute with a number on the domain element + - a mandatory name + - an optional uuid + --> + <define name='ids'> + <optional> + <attribute name='id'> + <ref name='unsignedInt'/> + </attribute> + </optional> + <interleave> + <element name="name"> + <ref name='domainName'/> + </element> + <optional> + <element name="uuid"> + <ref name='UUID'/> + </element> + </optional> + </interleave> + </define> + + <!-- + Resources usage defines the amount of memory (maximum and possibly + current usage) and number of virtual CPUs used by that domain. + We can't check here the rule that currentMemory <= memory + --> + + <define name='resources'> + <interleave> + <element name='memory'> + <ref name='memoryKB'/> + </element> + <optional> + <element name='currentMemory'> + <ref name='memoryKB'/> + </element> + </optional> + <optional> + <element name='vcpu'> + <optional> + <attribute name='cpuset' /> + </optional> + <ref name='countCPU'/> + </element> + </optional> + </interleave> + </define> + + <define name='clock'> + <optional> + <element name='clock'> + <attribute name='offset'> + <choice> + <value>localtime</value> + <value>utc</value> + </choice> + </attribute> + <empty/> + </element> + </optional> + </define> + + <!-- + A bootloader may be used to extract the OS information instead of + defining the OS parameter in the instance. It points just to the + binary or script used to extract the data from the first disk device. + --> + <define name='bootloader'> + <interleave> + <element name='bootloader'> + <choice> + <ref name='absFilePath'/> + <empty/> + </choice> + </element> + <optional> + <element name='bootloader_args'> + <text/> + </element> + </optional> + </interleave> + </define> + + <define name='osbootkernel'> + <interleave> + <element name='kernel'> + <ref name='absFilePath'/> + </element> + <optional> + <element name='initrd'> + <ref name='absFilePath'/> + </element> + </optional> + <optional> + <element name='root'> + <ref name='devicePath'/> + </element> + </optional> + <optional> + <element name='cmdline'> + <text/> + </element> + </optional> + </interleave> + </define> + + <define name='osbootdev'> + <element name='boot'> + <attribute name='dev'> + <choice> + <value>hd</value> + <value>fd</value> + <value>cdrom</value> + <value>network</value> + </choice> + </attribute> + <empty/> + </element> + </define> + + + <define name='diskspec'> + <optional> + <ref name='driver'/> + </optional> + <ref name='target'/> + <optional> + <element name='readonly'> + <empty/> + </element> + </optional> + <optional> + <element name='shareable'> + <empty/> + </element> + </optional> + </define> + + <!-- + A disk description can be either of type file or block + The name of the attribute on the source element depends on the type + + --> + <define name='disk'> + <element name='disk'> + <optional> + <attribute name='device'> + <choice> + <value>floppy</value> + <value>disk</value> + <value>cdrom</value> + </choice> + </attribute> + </optional> + <choice> + <group> + <attribute name='type'> + <value>file</value> + </attribute> + <interleave> + <optional> + <element name='source'> + <attribute name='file'> + <ref name='absFilePath'/> + </attribute> + <empty/> + </element> + </optional> + <ref name='diskspec'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>block</value> + </attribute> + <interleave> + <optional> + <element name='source'> + <attribute name='dev'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + </optional> + <ref name='diskspec'/> + </interleave> + </group> + <ref name='diskspec'/> + </choice> + </element> + </define> + + <define name='target'> + <element name='target'> + <attribute name='dev'> + <ref name='deviceName'/> + </attribute> + <optional> + <attribute name='bus'> + <choice> + <value>ide</value> + <value>virtio</value> + <value>fdc</value> + <value>xen</value> + <value>usb</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <!-- + Disk may use a special driver for access. Currently this is + only defined for Xen for tap/aio and file, but will certainly be + extended in the future, and libvirt doesn't look for specific values. + --> + <define name='driver'> + <element name='driver'> + <attribute name='name'> + <ref name='genericName'/> + </attribute> + <optional> + <attribute name='type'> + <ref name='genericName'/> + </attribute> + </optional> + <empty/> + </element> + </define> + + <define name='filesystem'> + <element name='filesystem'> + <choice> + <group> + <attribute name='type'> + <value>file</value> + </attribute> + <interleave> + <element name='source'> + <attribute name='file'> + <ref name='absFilePath'/> + </attribute> + <empty/> + </element> + <ref name='filesystemtgt'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>block</value> + </attribute> + <interleave> + <element name='source'> + <attribute name='dev'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + <ref name='filesystemtgt'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>mount</value> + </attribute> + <interleave> + <element name='source'> + <attribute name='dir'> + <ref name='absFilePath'/> + </attribute> + <empty/> + </element> + <ref name='filesystemtgt'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>template</value> + </attribute> + <interleave> + <element name='source'> + <attribute name='name'> + <ref name='genericName'/> + </attribute> + <empty/> + </element> + <ref name='filesystemtgt'/> + </interleave> + </group> + </choice> + </element> + </define> + + <define name='filesystemtgt'> + <element name='target'> + <attribute name='dir'> + <ref name='absDirPath'/> + </attribute> + <empty/> + </element> + </define> + + <!-- + An interface description can either be of type bridge in which case + it will use a bridging source, or of type ethernet which uses a device + source and a device target instead. They both share a set of interface + options. FIXME + --> + <define name='interface'> + <element name='interface'> + <choice> + <group> + <attribute name='type'> + <value>bridge</value> + </attribute> + <interleave> + <optional> + <element name='source'> + <attribute name='bridge'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + </optional> + <ref name='interface-options'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>ethernet</value> + </attribute> + <interleave> + <optional> + <element name='source'> + <attribute name='dev'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + </optional> + <ref name='interface-options'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>network</value> + </attribute> + <interleave> + <element name='source'> + <attribute name='network'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + <ref name='interface-options'/> + </interleave> + </group> + <group> + <attribute name='type'> + <value>user</value> + </attribute> + <interleave> + <ref name='interface-options'/> + </interleave> + </group> + </choice> + </element> + </define> + + <!-- + The interface options possible are: + - the MAC address + - the IP address bound to the interface + - the name of the script used to set up the binding + - the target device used + --> + <define name='interface-options'> + <interleave> + <optional> + <element name='target'> + <attribute name='dev'> + <ref name='deviceName'/> + </attribute> + <empty/> + </element> + </optional> + <optional> + <element name='mac'> + <attribute name='address'> + <ref name='addrMAC'/> + </attribute> + <empty/> + </element> + </optional> + <optional> + <element name='ip'> + <attribute name='address'> + <ref name='addrIP'/> + </attribute> + <empty/> + </element> + </optional> + <optional> + <element name='script'> + <attribute name='path'> + <ref name='filePath'/> + </attribute> + <empty/> + </element> + </optional> + <optional> + <element name='model'> + <attribute name='type' /> + <empty/> + </element> + </optional> + </interleave> + </define> + + <!-- + An emulator description is just a path to the binary used for the task + --> + <define name='emulator'> + <element name='emulator'> + <ref name='absFilePath'/> + </element> + </define> + + <!-- + A graphic description, currently in Xen only 2 types are supported: + - sdl with optional display, xauth and fullscreen + - vnc with a required port and optional listen IP address, password + and keymap + --> + <define name='graphic'> + <element name='graphics'> + <choice> + <group> + <attribute name='type'> + <value>sdl</value> + </attribute> + <optional> + <attribute name='display'> + <text/> + </attribute> + </optional> + <optional> + <attribute name='xauth'> + <text/> + </attribute> + </optional> + <optional> + <attribute name='fullscreen'> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + </group> + <group> + <attribute name='type'> + <value>vnc</value> + </attribute> + <optional> + <attribute name='port'> + <ref name='PortNumber'/> + </attribute> + </optional> + <optional> + <attribute name='autoport'> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name='listen'> + <ref name='addrIP'/> + </attribute> + </optional> + <optional> + <attribute name='passwd'> + <text/> + </attribute> + </optional> + <optional> + <attribute name='keymap'> + <text/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <!-- + When a domain terminates multiple policies can be applied depending + on how it ended: + --> + <define name='termination'> + <interleave> + <optional> + <element name='on_reboot'> + <ref name='offOptions'/> + </element> + </optional> + <optional> + <element name='on_poweroff'> + <ref name='offOptions'/> + </element> + </optional> + <optional> + <element name='on_crash'> + <ref name='offOptions'/> + </element> + </optional> + </interleave> + </define> + + <!-- + Options when a domain terminates: + destroy: The domain is cleaned up + restart: A new domain is started in place of the old one + preserve: The domain will remain in memory until it is destroyed manually + rename-restart: a variant of the previous one but where the old domain is + renamed before being saved to allow a restart + --> + <define name='offOptions'> + <choice> + <value>destroy</value> + <value>restart</value> + <value>preserve</value> + <value>rename-restart</value> + </choice> + </define> + + <!-- + Specific setup for a qemu emulated character device. Note: this + definition doesn't fully specify the constraints on this node. + --> + <define name='qemucdev'> + <attribute name='type'> + <choice> + <value>dev</value> + <value>file</value> + <value>pipe</value> + <value>unix</value> + <value>tcp</value> + <value>udp</value> + <value>null</value> + <value>stdio</value> + <value>vc</value> + <value>pty</value> + </choice> + </attribute> + + <interleave> + <optional> + <oneOrMore> + <element name='source'> + <optional> + <attribute name='mode' /> + </optional> + <optional> + <attribute name='path' /> + </optional> + <optional> + <attribute name='host' /> + </optional> + <optional> + <attribute name='service' /> + </optional> + <optional> + <attribute name='wiremode' /> + </optional> + </element> + </oneOrMore> + </optional> + <optional> + <element name='protocol'> + <optional> + <attribute name='type' /> + </optional> + </element> + </optional> + <optional> + <element name='target'> + <optional> + <attribute name='port' /> + </optional> + </element> + </optional> + </interleave> + </define> + + <!-- + The description for a console + just a tty device + --> + <define name='console'> + <element name='console'> + <choice> + <group> + <optional> + <attribute name='tty'> + <ref name='devicePath'/> + </attribute> + </optional> + <empty/> + </group> + <ref name='qemucdev' /> + </choice> + </element> + </define> + + <define name='sound'> + <element name='sound'> + <attribute name='model'> + <choice> + <value>sb16</value> + <value>es1370</value> + <value>pcspk</value> + </choice> + </attribute> + </element> + </define> + + <define name='parallel'> + <element name='parallel'> + <ref name='qemucdev' /> + </element> + </define> + + <define name='serial'> + <element name='serial'> + <ref name='qemucdev' /> + </element> + </define> + + <define name='input'> + <element name='input'> + <attribute name='type'> + <choice> + <value>tablet</value> + <value>mouse</value> + </choice> + </attribute> + <optional> + <attribute name='bus'> + <choice> + <value>ps2</value> + <value>usb</value> + <value>xen</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <define name='hostdev'> + <element name='hostdev'> + <optional> + <attribute name='mode'> + <choice> + <value>subsystem</value> + <value>capabilities</value> + </choice> + </attribute> + <attribute name='type'> + <choice> + <value>usb</value> + <value>pci</value> + </choice> + </attribute> + </optional> + <group> + <element name='source'> + <choice> + <ref name="usbproduct"/> + <ref name="usbaddress"/> + <ref name="pciaddress"/> + </choice> + </element> + </group> + </element> + </define> + + <define name="usbproduct"> + <element name="vendor"> + <attribute name="id"> + <ref name="usbId"/> + </attribute> + </element> + <element name="product"> + <attribute name="id"> + <ref name="usbId"/> + </attribute> + </element> + </define> + + <define name="usbaddress"> + <element name="address"> + <attribute name="bus"> + <ref name="usbAddr"/> + </attribute> + <attribute name="device"> + <ref name="usbAddr"/> + </attribute> + </element> + </define> + + <define name="pciaddress"> + <element name="address"> + <optional> + <attribute name="domain"> + <ref name="pciDomain"/> + </attribute> + </optional> + <attribute name="bus"> + <ref name="pciBus"/> + </attribute> + <attribute name="slot"> + <ref name="pciSlot"/> + </attribute> + <attribute name="function"> + <ref name="pciFunc"/> + </attribute> + </element> + </define> + <!-- + Devices attached to a domain. + --> + <define name='devices'> + <element name='devices'> + <interleave> + <optional> + <ref name='emulator'/> + </optional> + <zeroOrMore> + <choice> + <ref name='graphic'/> + <ref name='disk'/> + <ref name='filesystem'/> + <ref name='interface'/> + <ref name='console'/> + <ref name='sound'/> + <ref name='parallel'/> + <ref name='serial'/> + <ref name='input'/> + <ref name='hostdev'/> + </choice> + </zeroOrMore> + </interleave> + </element> + </define> + + <!-- + A set of optional features: PAE, APIC and ACPI support + --> + <define name='features'> + <optional> + <element name="features"> + <interleave> + <optional> + <element name="pae"> + <empty/> + </element> + </optional> + <optional> + <element name="apic"> + <empty/> + </element> + </optional> + <optional> + <element name="acpi"> + <empty/> + </element> + </optional> + </interleave> + </element> + </optional> + </define> + + <!-- + Type library + + Our unsignedInt doesn't allow a leading '+' in its lexical form + A domain name shoul be made of ascii, numbers, _-+ and is non-empty + UUID currently allows only the 32 characters strict syntax + memoryKB request at least 4Mbytes though Xen will grow bigger if too low + --> + <define name='unsignedInt'> + <data type='unsignedInt'> + <param name="pattern">[0-9]+</param> + </data> + </define> + <define name='countCPU'> + <data type='unsignedShort'> + <param name="pattern">[0-9]+</param> + <param name="minInclusive">1</param> + </data> + </define> + <define name='PortNumber'> + <data type='short'> + <param name="minInclusive">-1</param> + </data> + </define> + <define name='memoryKB'> + <data type='unsignedInt'> + <param name="pattern">[0-9]+</param> + <param name="minInclusive">4000</param> + </data> + </define> + <define name='domainName'> + <data type='string'> + <param name="pattern">[A-Za-z0-9_\.\+\-&:/]+</param> + </data> + </define> + <define name='genericName'> + <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='filePath'> + <data type='string'> + <param name="pattern">[a-zA-Z0-9_\.\+\-&/%]+</param> + </data> + </define> + <define name='absFilePath'> + <data type='string'> + <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]+</param> + </data> + </define> + <define name='absDirPath'> + <data type='string'> + <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]*</param> + </data> + </define> + <define name='devicePath'> + <data type='string'> + <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param> + </data> + </define> + <define name='deviceName'> + <data type='string'> + <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param> + </data> + </define> + <define name='addrMAC'> + <data type='string'> + <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param> + </data> + </define> + <define name='addrIP'> + <data type='string'> + <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param> + </data> + </define> + <define name='usbId'> + <data type='string'> + <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param> + </data> + </define> + <define name='usbAddr'> + <data type='string'> + <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param> + </data> + </define> + <define name='pciDomain'> + <data type='string'> + <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param> + </data> + </define> + <define name='pciBus'> + <data type='string'> + <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param> + </data> + </define> + <define name='pciSlot'> + <data type='string'> + <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param> + </data> + </define> + <define name='pciFunc'> + <data type='string'> + <param name="pattern">(0x)?[0-7]</param> + </data> + </define> +</grammar> diff -r 8eb4d4028b98 docs/schemas/network.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/network.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,69 @@ +<!-- A Relax NG schema for the libvirt network XML format --> +<element name="network" xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <!-- The name of the network, used to refer to it through the API + and in virsh --> + <element name="name"><text/></element> + <optional> + <element name="uuid"><text/></element> + </optional> + <optional> + <!-- The name of the network to be set up; this will back + the network on the host --> + <element name="bridge"> + <optional> + <attribute name="name"><text/></attribute> + </optional> + <optional> + <attribute name="stp"> + <choice> + <value>on</value> + <value>off</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="delay"><data type="integer"/></attribute> + </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. --> + <!-- FIXME: address, netmask and the start and end of the ranges + are IP addresses, and should be validated as such in the scheme --> + <element name="ip"> + <optional> + <attribute name="address"><text/></attribute> + </optional> + <optional> + <attribute name="netmask"><text/></attribute> + </optional> + <!-- Define the range(s) of IP addresses that the DHCP + server should hand out --> + <element name="dhcp"> + <zeroOrMore> + <element name="range"> + <attribute name="start"><text/></attribute> + <attribute name="end"><text/></attribute> + </element> + </zeroOrMore> + </element> + </element> + </optional> +</element> diff -r 8eb4d4028b98 docs/schemas/nodedev.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/nodedev.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,360 @@ +<!-- 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> diff -r 8eb4d4028b98 docs/schemas/storagepool.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/storagepool.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,371 @@ +<!-- 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> diff -r 8eb4d4028b98 docs/schemas/storagevol.rng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/schemas/storagevol.rng Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,187 @@ +<!-- 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> diff -r 8eb4d4028b98 libvirt.spec.in --- a/libvirt.spec.in Wed Jan 21 15:47:23 2009 +0000 +++ b/libvirt.spec.in Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 mingw32-libvirt.spec.in --- a/mingw32-libvirt.spec.in Wed Jan 21 15:47:23 2009 +0000 +++ b/mingw32-libvirt.spec.in Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/Makefile.am --- a/tests/Makefile.am Wed Jan 21 15:47:23 2009 +0000 +++ b/tests/Makefile.am Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/capabilityschemadata/caps-qemu-kvm.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/capabilityschemadata/caps-qemu-kvm.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,111 @@ +<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> + + diff -r 8eb4d4028b98 tests/capabilityschemadata/caps-test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/capabilityschemadata/caps-test.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,71 @@ +<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> + + diff -r 8eb4d4028b98 tests/capabilityschematest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/capabilityschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/domainschematest --- a/tests/domainschematest Wed Jan 21 15:47:23 2009 +0000 +++ b/tests/domainschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/networkschematest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/networkschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/nodedevschemadata/DVD_GCC_4247N.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/DVD_GCC_4247N.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,17 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/computer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/computer.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,18 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,11 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,11 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_1002_71c4.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/pci_1002_71c4.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,14 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,9 @@ +<device> + <name>pci_8086_27c5_scsi_host</name> + <parent>pci_8086_27c5</parent> + <capability type='scsi_host'> + <host>0</host> + </capability> +</device> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,9 @@ +<device> + <name>pci_8086_27c5_scsi_host_0</name> + <parent>pci_8086_27c5</parent> + <capability type='scsi_host'> + <host>1</host> + </capability> +</device> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,13 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,9 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,14 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,12 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,12 @@ +<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> + + diff -r 8eb4d4028b98 tests/nodedevschematest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/nodedevschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/storagepoolschemadata/pool-dir.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-dir.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,17 @@ +<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> diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-disk.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-disk.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,22 @@ +<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> diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-fs.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-fs.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,20 @@ +<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> + diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-iscsi.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-iscsi.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,10 @@ +<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> diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-logical.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-logical.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,19 @@ +<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> diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-netfs.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschemadata/pool-netfs.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,21 @@ +<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> + diff -r 8eb4d4028b98 tests/storagepoolschematest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagepoolschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -r 8eb4d4028b98 tests/storagevolschemadata/vol-logical.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagevolschemadata/vol-logical.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,21 @@ +<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> + diff -r 8eb4d4028b98 tests/storagevolschemadata/vol-partition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagevolschemadata/vol-partition.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,21 @@ +<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> diff -r 8eb4d4028b98 tests/storagevolschemadata/vol-qcow2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagevolschemadata/vol-qcow2.xml Wed Jan 21 16:28:43 2009 +0000 @@ -0,0 +1,28 @@ +<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> diff -r 8eb4d4028b98 tests/storagevolschematest --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/storagevolschematest Wed Jan 21 16:28:43 2009 +0000 @@ -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 -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list