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(a)redhat.com>
---
src/conf/schemas/domaincommon.rng | 3 +++
src/conf/schemas/privatedata.rng | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
create mode 100644 src/conf/schemas/privatedata.rng
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index ebdf21fe99..85e2e0c57b 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -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">
diff --git a/src/conf/schemas/privatedata.rng b/src/conf/schemas/privatedata.rng
new file mode 100644
index 0000000000..39551939fa
--- /dev/null
+++ b/src/conf/schemas/privatedata.rng
@@ -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>
--
2.38.1