[libvirt] [PATCH] xml: create an RNG file for common types and move some definitions there

Eric Blake eblake at redhat.com
Mon Jun 27 23:16:54 UTC 2011


On 06/26/2011 03:19 AM, Laine Stump wrote:
> domain.rng, network.rng, and interface.rng already use a few of the
> same types (or in some cases *should* but don't), and an upcoming code
> change will have them sharing even more. To prepare for that, this
> patch takes those common data type definitions and moves them into
> basictypes.rng.
> 
> This may break some rule about the need to RNG files to be autonomous
> or something, but I saw that storageencryption.rng is used in this
> way, so I figured it must not be completely against the law...
> ---
>  docs/schemas/basictypes.rng |  130 +++++++++++++++++++++++++++++++++++++++++++
>  docs/schemas/domain.rng     |   86 +---------------------------
>  docs/schemas/interface.rng  |   71 ++++-------------------
>  docs/schemas/network.rng    |   79 +++++++-------------------
>  4 files changed, 166 insertions(+), 200 deletions(-)
>  create mode 100644 docs/schemas/basictypes.rng

On the surface, this seems reasonable; however, it's probably to wait
until after 0.9.3 to actually commit it.

It looks like we could also make a few more files use this common file;
for example, <define name="UUID"> also appears in
{capability,nwfilter,secret,storagevol}.rng.

> 
> diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
> new file mode 100644
> index 0000000..b3267f5
> --- /dev/null
> +++ b/docs/schemas/basictypes.rng
> @@ -0,0 +1,130 @@
> +<?xml version="1.0"?>
> +<!-- network-related definitions used in multiple grammars -->
> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
> +
> +  <!-- Our unsignedInt doesn"t allow a leading "+" in its lexical form -->
> +  <define name="unsignedInt">
> +    <data type="unsignedInt">
> +      <param name="pattern">[0-9]+</param>
> +    </data>
> +  </define>
> +
> +  <define name="positiveInteger">
> +    <data type="positiveInteger">
> +      <param name="pattern">[0-9]+</param>
> +    </data>
> +  </define>

Should this one be excluding 0 via <param name="minInclusive">1</param>?

ACK to the changes, once we decide on timing.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110627/720fa9f7/attachment-0001.sig>


More information about the libvir-list mailing list