]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
schema: Introduce scaffolding for schema for <privateData> elements
authorPeter Krempa <pkrempa@redhat.com>
Thu, 8 Oct 2020 11:48:21 +0000 (13:48 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 3 Nov 2022 08:19:54 +0000 (09:19 +0100)
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>
src/conf/schemas/domaincommon.rng
src/conf/schemas/privatedata.rng [new file with mode: 0644]

index 2acb277b768ec50ec172d6dba661fd363404dbce..ebb39de3ef14f031988c1993c0d387fceb7c3988 100644 (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
     <interleave>
       <ref name="storageSourceExtra"/>
       <ref name="diskBackingChain"/>
+      <ref name="privateDataDeviceDisk"/>
     </interleave>
   </define>
 
         </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 (file)
index 0000000..3955193
--- /dev/null
@@ -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>