[libvirt] [PATCH] update libvirt.rng

Daniel Veillard veillard at redhat.com
Mon Jul 7 10:37:25 UTC 2008


On Mon, Jul 07, 2008 at 10:16:16AM +0100, Daniel P. Berrange wrote:
> On Sat, Jul 05, 2008 at 08:01:52PM +0100, John Levon wrote:
> > On Sat, Jul 05, 2008 at 05:51:50PM +0100, Daniel P. Berrange wrote:
> > 
> > > > The below patch makes a significant update to libvirt.rng to bring it
> > > > into line with reality. This is an incremental improvement rather than a
> > > > full fix. In particular, various parts are still under-specified (e.g.
> > > > qemu char devices).
> > > > 
> > > > This version lets almost all of the XML files in tests/ validate. I'd
> > > > appreciate help getting the last few to validate - any volunteers?

  Very cool ! Thanks !

  At ne point i was tempted to add a checking against the RNG when running
'make check' but the sytax was too much in flux to be realistic at the time.
Now that all the XML backend is being uniformized (we will have to refactor
OpenVZ code too BTW) it starts to make sense adding it.

  For a virsh command I think it's fine, the main difficulty is to make sure
we have a good hardcoded path for the rng file when 'make install' is done
and that the packaging includes the file.
The other option would be to include the .rng at compile time but it's
less generic though more reliable.

> > > Sure - what command are you using to validate ?
> > 
> > xmllint --noout --relaxng docs/libvirt.rng foo.xml
> 
> Here's a further update which makes all of them pass, except for one which
> had bogus XML that I've fixed. NB, I've done away with the xenpv/xenfv/kvm
> split in the top level domain element since this is unsustainable and does
> not really match what the newer XML parser will allow.
[...]
>    </define>
>    <define name='domainName'>
>      <data type='string'>
> -      <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
> +      <param name="pattern">[a-zA-Z0-9_\+\-&]+</param>
>      </data>
>    </define>
>    <define name='genericName'>
> @@ -708,12 +860,12 @@
>    </define>
>    <define name='filePath'>
>      <data type='string'>
> -      <param name="pattern">[a-zA-Z0-9_\+\-%./]+</param>
> +      <param name="pattern">[a-zA-Z0-9_\+\-%./&]+</param>
>      </data>
>    </define>
>    <define name='absFilePath'>
>      <data type='string'>
> -      <param name="pattern">/[a-zA-Z0-9_\+\-%./]+</param>
> +      <param name="pattern">/[a-zA-Z0-9_\+\-%./&]+</param>
>      </data>
>    </define>
>    <define name='devicePath'>

  yes I added recently one example with various & added to make sure the
escaping to/from XML was correctly handled, the other special chars from
an XML viewpoint are < > ' and " which i don't think should be supported
by libvirt. There is also most of the ASCII chars below ' ' 0x20 which
are forbidden in XML and not escapable, i don't think we should try to
allow them either.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list