Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 10 participants
- 40164 discussions
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232576262 28800
# Node ID c58822f94b2b5e87a363128a4bd36ec2846054fe
# Parent c109dd0801246b82aed8d5f9b1fa4196432868d0
Add a rule for generating .hgignore
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/Makefile.maint b/Makefile.maint
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -717,3 +717,5 @@ sync-vcs-ignore-files:
mv $(c2g)-t $(c2g)
perl $(c2g)
rm -f $(c2g)
+ find $(srcdir) -name .gitignore | xargs cat \
+ | sort -u | sed 's+\*+.*+' >.hgignore
4
5
[libvirt] PATCH: Add RNG schemas for capabilities, storage and node device XML
by Daniel P. Berrange 22 Jan '09
by Daniel P. Berrange 22 Jan '09
22 Jan '09
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 :|
3
2
The domain XML has long supported ability to set the disk driver type
but we only used it in Xen so far.
This patch adds support for QEMU usage. In this usage the driver name
is always going to be 'qemu' since all backends are in QEMU, no alternate
kernelspace / helper daemons as with Xen. The driver type will be one of
the valid QEMU disk formats.
eg
<driver name='qemu' type='qcow2'/>
The snprintf() stuff for building the disk parameter string was getting
rather out of hand, so I took the opportunity to switch it over to use
the virBuffer routines.
src/qemu_conf.c | 49 ++++++++---
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args | 1
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml | 29 ++++++
tests/qemuxml2argvtest.c | 2
tests/qemuxml2xmltest.c | 1
5 files changed, 69 insertions(+), 13 deletions(-)
Daniel
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -48,6 +48,8 @@
#include "xml.h"
#include "nodeinfo.h"
+#define VIR_FROM_THIS VIR_FROM_QEMU
+
VIR_ENUM_DECL(virDomainDiskQEMUBus)
VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_DOMAIN_DISK_BUS_LAST,
"ide",
@@ -862,6 +864,18 @@ int qemudBuildCommandLine(virConnectPtr
ADD_ARG_LIT(vm->def->os.bootloader);
}
+ for (i = 0 ; i < vm->def->ndisks ; i++) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+
+ if (disk->driverName != NULL &&
+ !STREQ(disk->driverName, "qemu")) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("unsupported driver name '%s' for disk '%s'"),
+ disk->driverName, disk->src);
+ goto error;
+ }
+ }
+
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
int bootCD = 0, bootFloppy = 0, bootDisk = 0;
@@ -884,8 +898,8 @@ int qemudBuildCommandLine(virConnectPtr
}
for (i = 0 ; i < vm->def->ndisks ; i++) {
- char opt[PATH_MAX];
- const char *media = NULL;
+ virBuffer opt = VIR_BUFFER_INITIALIZER;
+ char *optstr;
int bootable = 0;
virDomainDiskDefPtr disk = vm->def->disks[i];
int idx = virDiskNameToIndex(disk->dst);
@@ -912,7 +926,6 @@ int qemudBuildCommandLine(virConnectPtr
case VIR_DOMAIN_DISK_DEVICE_CDROM:
bootable = bootCD;
bootCD = 0;
- media = "media=cdrom,";
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
bootable = bootFloppy;
@@ -924,18 +937,28 @@ int qemudBuildCommandLine(virConnectPtr
break;
}
- snprintf(opt, PATH_MAX, "file=%s,if=%s,%sindex=%d%s%s",
- disk->src ? disk->src : "", bus,
- media ? media : "",
- idx,
- bootable &&
- disk->device == VIR_DOMAIN_DISK_DEVICE_DISK
- ? ",boot=on" : "",
- disk->shared && ! disk->readonly
- ? ",cache=off" : "");
+ virBufferVSprintf(&opt, "file=%s", disk->src ? disk->src : "");
+ virBufferVSprintf(&opt, ",if=%s", bus);
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+ virBufferAddLit(&opt, ",media=cdrom");
+ virBufferVSprintf(&opt, ",index=%d", idx);
+ if (bootable &&
+ disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
+ virBufferAddLit(&opt, ",boot=on");
+ if (disk->shared && !disk->readonly)
+ virBufferAddLit(&opt, ",cache=off");
+ if (disk->driverType)
+ virBufferVSprintf(&opt, ",fmt=%s", disk->driverType);
+
+ if (virBufferError(&opt)) {
+ virReportOOMError(conn);
+ goto error;
+ }
+
+ optstr = virBufferContentAndReset(&opt);
ADD_ARG_LIT("-drive");
- ADD_ARG_LIT(opt);
+ ADD_ARG(optstr);
}
} else {
for (i = 0 ; i < vm->def->ndisks ; i++) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
new file mode 100644
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on,fmt=qcow2 -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
new file mode 100644
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='block' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -194,6 +194,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("disk-drive-boot-cdrom", QEMUD_CMD_FLAG_DRIVE |
QEMUD_CMD_FLAG_DRIVE_BOOT);
+ DO_TEST("disk-drive-fmt-qcow", QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("disk-usb", 0);
DO_TEST("graphics-vnc", 0);
DO_TEST("graphics-sdl", 0);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -97,6 +97,7 @@ mymain(int argc, char **argv)
DO_TEST("disk-many");
DO_TEST("disk-xenvbd");
DO_TEST("disk-usb");
+ DO_TEST("disk-drive-fmt-qcow");
DO_TEST("graphics-vnc");
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
--
|: 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 :|
2
1
[libvirt] Re: kvm-81: save / restore does not work - missing incoming stdio feature
by Daniel Schwager 22 Jan '09
by Daniel Schwager 22 Jan '09
22 Jan '09
Hi Daniel,
I'm also VERY interesting in save/restore my Domains to disk - is
there a roadmap back to this feature - did you talk with the qemu
developers ?
Or should I try to contact them ?
regards
Danny
> From: Matthias Pfafferodt <matthias.pfafferodt <at> mapfa.de>
> Subject: Re: [libvirt] kvm: save / restore
>
> Hello Daniel,
>
> thnaks for your anser. Do you know the plans regarding save/restore in
kvm and
> libvirt? I would like to save my vm's at shutdown and restore at boot
time.
> At the moment this is not working and shutdown is used.
Am Thursday 18 December 2008 13:42:36 schrieb Daniel P. Berrange:
> On Wed, Dec 17, 2008 at 01:46:43PM +0100, Matthias Pfafferodt wrote:
> > Hallo,
> >
> > I use kvm-81 and libvirt 0.5.1. I can save a kvm donain but if I
want to
> > restore it I get the following error in the log file:
> >
> > unknown migration protocol: stdio
> >
> > I tried it using only kvm and got the same error.
> >
> > How can I save / restore a VM to / from a file?
>
> The new KVM release dropped support for the '-incoming stdio' syntax
> that libvirt was using so save/restore no longer works :-(
>
> Daniel
4
6
[libvirt] [PATCH] Support script setting for bridge-type interfaces
by john.levon@sun.com 22 Jan '09
by john.levon@sun.com 22 Jan '09
22 Jan '09
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232562793 28800
# Node ID e0b0295722ecf4645983e3a9a090e0aaabc40da7
# Parent ce10bb67bbcee1a49b900e260a65ccfb1b69588b
Support script setting for bridge-type interfaces
Fix back-compatibility by allowing non-default scripts in interfaces
of bridge type again.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/domain_conf.c b/src/domain_conf.c
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -288,6 +288,7 @@ void virDomainNetDefFree(virDomainNetDef
case VIR_DOMAIN_NET_TYPE_BRIDGE:
VIR_FREE(def->data.bridge.brname);
+ VIR_FREE(def->data.bridge.script);
break;
}
@@ -897,7 +898,8 @@ virDomainNetDefParseXML(virConnectPtr co
VIR_FREE(ifname);
}
} else if ((script == NULL) &&
- (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET) &&
+ (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET ||
+ def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
xmlStrEqual(cur->name, BAD_CAST "script")) {
script = virXMLPropString(cur, "path");
} else if (xmlStrEqual (cur->name, BAD_CAST "model")) {
@@ -948,6 +950,10 @@ virDomainNetDefParseXML(virConnectPtr co
}
def->data.bridge.brname = bridge;
bridge = NULL;
+ if (script != NULL) {
+ def->data.bridge.script = script;
+ script = NULL;
+ }
break;
case VIR_DOMAIN_NET_TYPE_CLIENT:
@@ -2883,6 +2889,9 @@ virDomainNetDefFormat(virConnectPtr conn
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virBufferEscapeString(buf, " <source bridge='%s'/>\n",
def->data.bridge.brname);
+ if (def->data.bridge.script)
+ virBufferEscapeString(buf, " <script path='%s'/>\n",
+ def->data.bridge.script);
break;
case VIR_DOMAIN_NET_TYPE_SERVER:
diff --git a/src/domain_conf.h b/src/domain_conf.h
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -154,6 +154,7 @@ struct _virDomainNetDef {
} network;
struct {
char *brname;
+ char *script;
} bridge;
} data;
char *ifname;
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -60,6 +60,12 @@
#define XEN_SCHED_CRED_NPARAM 2
#endif /* PROXY */
+
+#ifdef __sun
+#define DEFAULT_VIF_SCRIPT "vif-vnic"
+#else
+#define DEFAULT_VIF_SCRIPT "vif-bridge"
+#endif
#ifdef WITH_RHEL5_API
#define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0
@@ -1739,15 +1745,22 @@ xenDaemonParseSxprNets(virConnectPtr con
if (VIR_ALLOC(net) < 0)
goto no_memory;
- if ((tmp2 && strstr(tmp2, "bridge")) || tmp) {
+ if (tmp != NULL || (STREQ(tmp2, DEFAULT_VIF_SCRIPT))) {
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
/* XXX virtual network reverse resolve */
if (tmp &&
!(net->data.bridge.brname = strdup(tmp)))
goto no_memory;
+ if (tmp2 &&
+ net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
+ !(net->data.bridge.script = strdup(tmp2)))
+ goto no_memory;
} else {
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ if (tmp2 &&
+ !(net->data.ethernet.script = strdup(tmp2)))
+ goto no_memory;
}
tmp = sexpr_node(node, "device/vif/vifname");
@@ -1784,11 +1797,6 @@ xenDaemonParseSxprNets(virConnectPtr con
tmp = sexpr_node(node, "device/vif/ip");
if (tmp &&
!(net->data.ethernet.ipaddr = strdup(tmp)))
- goto no_memory;
-
- if (tmp2 &&
- net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
- !(net->data.ethernet.script = strdup(tmp2)))
goto no_memory;
if (model &&
@@ -5069,6 +5077,8 @@ xenDaemonFormatSxprNet(virConnectPtr con
int xendConfigVersion,
int isAttach)
{
+ const char *script = DEFAULT_VIF_SCRIPT;
+
if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
def->type != VIR_DOMAIN_NET_TYPE_NETWORK &&
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
@@ -5090,7 +5100,10 @@ xenDaemonFormatSxprNet(virConnectPtr con
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virBufferVSprintf(buf, "(bridge '%s')", def->data.bridge.brname);
- virBufferAddLit(buf, "(script 'vif-bridge')");
+ if (def->data.bridge.script)
+ script = def->data.bridge.script;
+
+ virBufferVSprintf(buf, "(script '%s')", script);
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
@@ -5113,7 +5126,7 @@ xenDaemonFormatSxprNet(virConnectPtr con
return -1;
}
virBufferVSprintf(buf, "(bridge '%s')", bridge);
- virBufferAddLit(buf, "(script 'vif-bridge')");
+ virBufferVSprintf(buf, "(script '%s')", script);
VIR_FREE(bridge);
}
break;
diff --git a/src/xm_internal.c b/src/xm_internal.c
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1057,14 +1057,19 @@ xenXMDomainConfigParse(virConnectPtr con
net->mac[5] = rawmac[5];
}
- if (bridge[0] || STREQ(script, "vif-bridge"))
+ if (bridge[0] || STREQ(script, "vif-bridge") ||
+ STREQ(script, "vif-vnic")) {
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
- else
+ } else {
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+ }
if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
if (bridge[0] &&
!(net->data.bridge.brname = strdup(bridge)))
+ goto no_memory;
+ if (script[0] &&
+ !(net->data.bridge.script = strdup(script)))
goto no_memory;
} else {
if (script[0] &&
diff --git a/tests/sexpr2xmldata/sexpr2xml-curmem.xml b/tests/sexpr2xmldata/sexpr2xml-curmem.xml
--- a/tests/sexpr2xmldata/sexpr2xml-curmem.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-curmem.xml
@@ -24,6 +24,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1d:06:15'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif5.0'/>
</interface>
<console type='pty'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml b/tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml
--- a/tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml
@@ -22,6 +22,7 @@
<interface type='bridge'>
<mac address='00:16:3e:23:9e:eb'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif6.0'/>
</interface>
<console type='pty'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<parallel type='tcp'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='file'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='null'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='pipe'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='pty'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='stdio'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='tcp'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='tcp'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='udp'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<serial type='unix'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-sound.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='usb'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='tablet' bus='usb'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-fv.xml b/tests/sexpr2xmldata/sexpr2xml-fv.xml
--- a/tests/sexpr2xmldata/sexpr2xml-fv.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-fv.xml
@@ -32,6 +32,7 @@
<interface type='bridge'>
<mac address='00:16:3e:1b:b1:47'/>
<source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
<target dev='vif3.0'/>
</interface>
<input type='mouse' bus='ps2'/>
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml b/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
--- a/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
@@ -23,6 +23,7 @@
<interface type='bridge'>
<mac address='00:11:22:33:44:55'/>
<source bridge='xenbr2'/>
+ <script path='vif-bridge'/>
<target dev='vif6.0'/>
</interface>
<console type='pty'>
diff --git a/tests/sexpr2xmldata/sexpr2xml-net-e1000.xml b/tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
--- a/tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
+++ b/tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
@@ -23,6 +23,7 @@
<interface type='bridge'>
<mac address='00:11:22:33:44:55'/>
<source bridge='xenbr2'/>
+ <script path='vif-bridge'/>
<target dev='vif6.0'/>
<model type='e1000'/>
</interface>
2
1
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232478815 28800
# Node ID 9c7ef175f3a797ecc3ffa6b1fed5a27d1814838c
# Parent ce76623e857f5bb2cf3af8414335f891fd7902b7
Solaris least privilege support
On Solaris dom0, virtd runs as a privilege barrier: all libvirt
connections are routed through it, and it performs the relevant
privilege checks for any clients.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/qemud/qemud.c b/qemud/qemud.c
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -84,6 +84,39 @@
#endif
+#ifdef __sun
+#include <ucred.h>
+#include <priv.h>
+
+#ifndef PRIV_VIRT_MANAGE
+#define PRIV_VIRT_MANAGE ((const char *)"virt_manage")
+#endif
+
+#ifndef PRIV_XVM_CONTROL
+#define PRIV_XVM_CONTROL ((const char *)"xvm_control")
+#endif
+
+#define PU_RESETGROUPS 0x0001 /* Remove supplemental groups */
+#define PU_CLEARLIMITSET 0x0008 /* L=0 */
+
+extern int __init_daemon_priv(int, uid_t, gid_t, ...);
+
+#define SYSTEM_UID 60
+
+static gid_t unix_sock_gid = 60; /* Not used */
+static int unix_sock_rw_mask = 0666;
+static int unix_sock_ro_mask = 0666;
+
+#else
+
+#define SYSTEM_UID 0
+
+static gid_t unix_sock_gid = 0; /* Only root by default */
+static int unix_sock_rw_mask = 0700; /* Allow user only */
+static int unix_sock_ro_mask = 0777; /* Allow world */
+
+#endif /* __sun */
+
static int godaemon = 0; /* -d: Be a daemon */
static int verbose = 0; /* -v: Verbose mode */
static int timeout = -1; /* -t: Shutdown timeout */
@@ -101,10 +134,6 @@ static char *listen_addr = (char *) LIB
static char *listen_addr = (char *) LIBVIRTD_LISTEN_ADDR;
static char *tls_port = (char *) LIBVIRTD_TLS_PORT;
static char *tcp_port = (char *) LIBVIRTD_TCP_PORT;
-
-static gid_t unix_sock_gid = 0; /* Only root by default */
-static int unix_sock_rw_mask = 0700; /* Allow user only */
-static int unix_sock_ro_mask = 0777; /* Allow world */
#if HAVE_POLKIT
static int auth_unix_rw = REMOTE_AUTH_POLKIT;
@@ -638,10 +667,11 @@ static int qemudInitPaths(struct qemud_s
static int qemudInitPaths(struct qemud_server *server,
char *sockname,
char *roSockname,
- int maxlen) {
+ int maxlen)
+{
uid_t uid = geteuid();
- if (!uid) {
+ if (uid == SYSTEM_UID) {
if (snprintf (sockname, maxlen, "%s/run/libvirt/libvirt-sock",
LOCAL_STATE_DIR) >= maxlen)
goto snprintf_error;
@@ -1110,6 +1140,29 @@ static int qemudDispatchServer(struct qe
return -1;
}
+#ifdef __sun
+ {
+ ucred_t *ucred = NULL;
+ const priv_set_t *privs;
+
+ if (getpeerucred (fd, &ucred) == -1 ||
+ (privs = ucred_getprivset (ucred, PRIV_EFFECTIVE)) == NULL) {
+ if (ucred != NULL)
+ ucred_free (ucred);
+ close (fd);
+ return -1;
+ }
+
+ if (!priv_ismember (privs, PRIV_VIRT_MANAGE)) {
+ ucred_free (ucred);
+ close (fd);
+ return -1;
+ }
+
+ ucred_free (ucred);
+ }
+#endif /* __sun */
+
/* Disable Nagle. Unix sockets will ignore this. */
setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (void *)&no_slow_start,
sizeof no_slow_start);
@@ -2257,6 +2310,30 @@ version (const char *argv0)
{
printf ("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
}
+
+#ifdef __sun
+static int
+qemudSetupPrivs (void)
+{
+ chown ("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
+
+ if (__init_daemon_priv (PU_RESETGROUPS | PU_CLEARLIMITSET,
+ SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
+ fprintf (stderr, "additional privileges are required\n");
+ return -1;
+ }
+
+ if (priv_set (PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
+ PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
+ fprintf (stderr, "failed to set reduced privileges\n");
+ return -1;
+ }
+
+ return 0;
+}
+#else
+#define qemudSetupPrivs() 0
+#endif
/* Print command-line usage. */
static void
@@ -2435,6 +2512,21 @@ int main(int argc, char **argv) {
sig_action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sig_action, NULL);
+ /* Ensure the rundir exists (on tmpfs on some systems) */
+ if (geteuid () == 0) {
+ const char *rundir = LOCAL_STATE_DIR "/run/libvirt";
+
+ if (mkdir (rundir, 0755)) {
+ if (errno != EEXIST) {
+ VIR_ERROR0 (_("unable to create rundir"));
+ return -1;
+ }
+ }
+ }
+
+ if (qemudSetupPrivs() < 0)
+ goto error2;
+
if (!(server = qemudInitialize(sigpipe[0]))) {
ret = 2;
goto error2;
diff --git a/src/remote_internal.c b/src/remote_internal.c
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -885,18 +885,21 @@ remoteOpen (virConnectPtr conn,
}
/*
- * If URI is NULL, then do a UNIX connection
- * possibly auto-spawning unprivileged server
- * and probe remote server for URI
+ * If URI is NULL, then do a UNIX connection possibly auto-spawning
+ * unprivileged server and probe remote server for URI. On Solaris,
+ * this isn't supported, but we may be privileged enough to connect
+ * to the UNIX socket anyway.
*/
if (!conn->uri) {
DEBUG0("Auto-probe remote URI");
rflags |= VIR_DRV_OPEN_REMOTE_UNIX;
+#ifndef __sun
if (getuid() > 0) {
DEBUG0("Auto-spawn user daemon instance");
rflags |= VIR_DRV_OPEN_REMOTE_USER;
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
}
+#endif
}
priv->sock = -1;
diff --git a/src/xen_internal.c b/src/xen_internal.c
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -26,6 +26,17 @@
#include <errno.h>
#include <sys/utsname.h>
+#ifdef __sun
+#include <sys/systeminfo.h>
+
+#include <priv.h>
+
+#ifndef PRIV_XVM_CONTROL
+#define PRIV_XVM_CONTROL ((const char *)"xvm_control")
+#endif
+
+#endif /* __sun */
+
/* required for dom0_getdomaininfo_t */
#include <xen/dom0_ops.h>
#include <xen/version.h>
@@ -35,10 +46,6 @@
#ifdef HAVE_XEN_SYS_PRIVCMD_H
#include <xen/sys/privcmd.h>
#endif
-#endif
-
-#ifdef __sun
-#include <sys/systeminfo.h>
#endif
/* required for shutdown flags */
@@ -3393,3 +3400,17 @@ xenHypervisorGetVcpuMax(virDomainPtr dom
return maxcpu;
}
+/**
+ * xenHavePrivilege()
+ *
+ * Return true if the current process should be able to connect to Xen.
+ */
+int
+xenHavePrivilege()
+{
+#ifdef __sun
+ return priv_ineffect (PRIV_XVM_CONTROL);
+#else
+ return getuid () == 0;
+#endif
+}
diff --git a/src/xen_internal.h b/src/xen_internal.h
--- a/src/xen_internal.h
+++ b/src/xen_internal.h
@@ -104,4 +104,6 @@ int xenHypervisorNodeGetCellsFreeMem
int startCell,
int maxCells);
+int xenHavePrivilege(void);
+
#endif /* __VIR_XEN_INTERNAL_H__ */
diff --git a/src/xen_unified.c b/src/xen_unified.c
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -65,6 +65,8 @@ static struct xenUnifiedDriver *drivers[
#endif
};
+static int inside_daemon;
+
#define xenUnifiedError(conn, code, fmt...) \
virReportErrorHelper(conn, VIR_FROM_XEN, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
@@ -195,6 +197,21 @@ done:
return(res);
}
+#ifdef WITH_LIBVIRTD
+
+static int
+xenInitialize (void)
+{
+ inside_daemon = 1;
+ return 0;
+}
+
+static virStateDriver state_driver = {
+ .initialize = xenInitialize,
+};
+
+#endif
+
/*----- Dispatch functions. -----*/
/* These dispatch functions follow the model used historically
@@ -231,6 +248,15 @@ xenUnifiedOpen (virConnectPtr conn, virC
xenUnifiedPrivatePtr priv;
virDomainEventCallbackListPtr cbList;
+#ifdef __sun
+ /*
+ * Only the libvirtd instance can open this driver.
+ * Everything else falls back to the remote driver.
+ */
+ if (!inside_daemon)
+ return VIR_DRV_OPEN_DECLINED;
+#endif
+
if (conn->uri == NULL) {
if (!xenUnifiedProbe())
return VIR_DRV_OPEN_DECLINED;
@@ -283,8 +309,8 @@ xenUnifiedOpen (virConnectPtr conn, virC
priv->proxy = -1;
- /* Hypervisor is only run as root & required to succeed */
- if (getuid() == 0) {
+ /* Hypervisor is only run with privilege & required to succeed */
+ if (xenHavePrivilege()) {
DEBUG0("Trying hypervisor sub-driver");
if (drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->open(conn, auth, flags) ==
VIR_DRV_OPEN_SUCCESS) {
@@ -293,7 +319,7 @@ xenUnifiedOpen (virConnectPtr conn, virC
}
}
- /* XenD is required to suceed if root.
+ /* XenD is required to succeed if privileged.
* If it fails as non-root, then the proxy driver may take over
*/
DEBUG0("Trying XenD sub-driver");
@@ -318,12 +344,12 @@ xenUnifiedOpen (virConnectPtr conn, virC
DEBUG0("Activated XS sub-driver");
priv->opened[XEN_UNIFIED_XS_OFFSET] = 1;
} else {
- if (getuid() == 0)
- goto fail; /* XS is mandatory as root */
+ if (xenHavePrivilege())
+ goto fail; /* XS is mandatory when privileged */
}
} else {
- if (getuid() == 0) {
- goto fail; /* XenD is mandatory as root */
+ if (xenHavePrivilege()) {
+ goto fail; /* XenD is mandatory when privileged */
} else {
#if WITH_PROXY
DEBUG0("Trying proxy sub-driver");
@@ -1472,6 +1498,10 @@ xenRegister (void)
(void) xenHypervisorInit ();
(void) xenXMInit ();
+#ifdef WITH_LIBVIRTD
+ if (virRegisterStateDriver (&state_driver) == -1) return -1;
+#endif
+
return virRegisterDriver (&xenUnifiedDriver);
}
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -42,7 +42,7 @@
#include "buf.h"
#include "uuid.h"
#include "xen_unified.h"
-#include "xen_internal.h" /* for DOM0_INTERFACE_VERSION */
+#include "xen_internal.h"
#include "xs_internal.h" /* To extract VNC port & Serial console TTY */
#include "memory.h"
@@ -159,9 +159,10 @@ do_connect(virConnectPtr xend)
s = -1;
/*
- * Connecting to XenD as root is mandatory, so log this error
+ * Connecting to XenD when privileged is mandatory, so log this
+ * error
*/
- if (getuid() == 0) {
+ if (xenHavePrivilege()) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to connect to xend"));
}
diff --git a/src/xs_internal.c b/src/xs_internal.c
--- a/src/xs_internal.c
+++ b/src/xs_internal.c
@@ -35,7 +35,7 @@
#include "uuid.h"
#include "xen_unified.h"
#include "xs_internal.h"
-#include "xen_internal.h" /* for xenHypervisorCheckID */
+#include "xen_internal.h"
#ifdef __linux__
#define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd"
@@ -299,11 +299,11 @@ xenStoreOpen(virConnectPtr conn,
if (priv->xshandle == NULL) {
/*
- * not being able to connect via the socket as a normal user
- * is rather normal, this should fallback to the proxy (or
+ * not being able to connect via the socket as an unprivileged
+ * user is rather normal, this should fallback to the proxy (or
* remote) mechanism.
*/
- if (getuid() == 0) {
+ if (xenHavePrivilege()) {
virXenStoreError(NULL, VIR_ERR_NO_XEN,
"%s", _("failed to connect to Xen Store"));
}
2
1
1
0
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232563649 28800
# Node ID 256c8a54b46909dcdd6999d55538e64ec5931e4d
# Parent c109dd0801246b82aed8d5f9b1fa4196432868d0
Add .hgignore entries
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -1,6 +1,38 @@
-(^|/)CVS($|/)
-(^|/)\.hg($|/)
-(^|/)\.hgtags($|/)
-^state$
-^state.old$
-^state.journal$
+.*.a
+.*.o
+.*.orig
+.*.rej
+.*~
+.git
+ABOUT-NLS
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.rpath
+config.status
+config.sub
+configure
+coverage
+libtool
+libvirt-.*.tar.gz
+libvirt.pc
+libvirt.spec
+ltconfig
+ltmain.sh
+m4
+mingw32-libvirt.spec
+mkinstalldirs
+results.log
+stamp-h
+stamp-h.in
+stamp-h1
+update.log
+TAGS
3
2
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232563649 28800
# Node ID 256c8a54b46909dcdd6999d55538e64ec5931e4d
# Parent c109dd0801246b82aed8d5f9b1fa4196432868d0
Add .hgignore entries
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -1,6 +1,38 @@
-(^|/)CVS($|/)
-(^|/)\.hg($|/)
-(^|/)\.hgtags($|/)
-^state$
-^state.old$
-^state.journal$
+.*.a
+.*.o
+.*.orig
+.*.rej
+.*~
+.git
+ABOUT-NLS
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.rpath
+config.status
+config.sub
+configure
+coverage
+libtool
+libvirt-.*.tar.gz
+libvirt.pc
+libvirt.spec
+ltconfig
+ltmain.sh
+m4
+mingw32-libvirt.spec
+mkinstalldirs
+results.log
+stamp-h
+stamp-h.in
+stamp-h1
+update.log
+TAGS
1
0
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232501231 28800
# Node ID 12e2e9f6eb99f86c2ab20f1e6a7b7a77418e66db
# Parent 39479c2678f822349169112e31e6061af3289548
Fix remote driver crash
Ensure ->watch is initialized so it's not used before an
updateHandleImpl is registered.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/remote_internal.c b/src/remote_internal.c
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -902,7 +902,9 @@ remoteOpen (virConnectPtr conn,
#endif
}
+ priv->watch = -1;
priv->sock = -1;
+
ret = doRemoteOpen(conn, priv, auth, rflags);
if (ret != VIR_DRV_OPEN_SUCCESS) {
conn->privateData = NULL;
3
2