schema: Introduce scaffolding for schema for <privateData> elements

Libvirt internally (e.g. in the status XML) stores additional data for
various objects described by the XML. The data is usually stored in
<privateData> or similar sub-elements.

This patch adds possibility for internal schema files to describe the
<privateData> elements by schema while still disallowing them for the
public schema.

This patch adds definitions for private data of <disk> and the
corresponding storage source of a disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-08 13:48:21 +02:00
parent 32d49d4b91
commit d8ceacdc87
2 changed files with 33 additions and 0 deletions

View File

@ -6,6 +6,7 @@
<include href="networkcommon.rng"/>
<include href="cputypes.rng"/>
<include href="nwfilter_params.rng"/>
<include href="privatedata.rng"/>
<!--
description and title element, may be placed anywhere under the root
@ -1698,6 +1699,7 @@
<interleave>
<ref name="storageSourceExtra"/>
<ref name="diskBackingChain"/>
<ref name="privateDataDeviceDisk"/>
</interleave>
</define>
@ -1773,6 +1775,7 @@
</element>
</element>
</optional>
<ref name="privateDataStorageSource"/>
</define>
<define name="diskSource">

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- This schema is provides scaffolding for having proper schema for private
data elements used by libvirt internally.
Public schema must not implement any of the defines below.
To override the definitions below use:
<define name="..." combine="choice">
-->
<define name="privateDataStorageSource">
<optional>
<element name="privateData">
<notAllowed/>
</element>
</optional>
</define>
<define name="privateDataDeviceDisk">
<optional>
<element name="privateData">
<notAllowed/>
</element>
</optional>
</define>
</grammar>