[PATCH 6/7] schema: Add schema for '<inactiveDomain>' element used in the snapshot definition

Peter Krempa posted 7 patches 3 years, 5 months ago
[PATCH 6/7] schema: Add schema for '<inactiveDomain>' element used in the snapshot definition
Posted by Peter Krempa 3 years, 5 months ago
The '<inactiveDomain>' element stores the next-start definition of a VM
on snapshot. It was not covered by the schema when it was introduced.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121276
Fixes: 152c165d34cb6dcd21d08427422850f406cd0643
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/schemas/domaincommon.rng   |  7 +++++++
 src/conf/schemas/domainsnapshot.rng |  5 +++++
 src/conf/schemas/inactiveDomain.rng | 10 ++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 src/conf/schemas/inactiveDomain.rng

diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index cc6a3475c8..ae04e0ea7d 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -37,6 +37,13 @@
     </element>
   </define>

+  <!-- this element is used as a child of a snapshot definition -->
+  <define name="inactiveDomain">
+    <element name="inactiveDomain">
+      <ref name="domaincontents"/>
+    </element>
+  </define>
+
   <define name="domaincontents">
     <ref name="hvs"/>
     <interleave>
diff --git a/src/conf/schemas/domainsnapshot.rng b/src/conf/schemas/domainsnapshot.rng
index a5d1a40493..3db9f458ba 100644
--- a/src/conf/schemas/domainsnapshot.rng
+++ b/src/conf/schemas/domainsnapshot.rng
@@ -83,6 +83,11 @@
             </grammar>
           </choice>
         </optional>
+        <optional>
+          <grammar>
+            <include href="inactiveDomain.rng"/>
+          </grammar>
+        </optional>
         <optional>
           <element name="parent">
             <element name="name">
diff --git a/src/conf/schemas/inactiveDomain.rng b/src/conf/schemas/inactiveDomain.rng
new file mode 100644
index 0000000000..ae1207d978
--- /dev/null
+++ b/src/conf/schemas/inactiveDomain.rng
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+  <!-- inactiveDomain element grammar is included into domainsnapshot.rng -->
+  <start>
+    <ref name="inactiveDomain"/>
+  </start>
+
+  <include href="domainoverrides.rng"/>
+
+</grammar>
-- 
2.37.1
Re: [PATCH 6/7] schema: Add schema for '<inactiveDomain>' element used in the snapshot definition
Posted by Michal Prívozník 3 years, 5 months ago
On 8/25/22 11:46, Peter Krempa wrote:
> The '<inactiveDomain>' element stores the next-start definition of a VM
> on snapshot. It was not covered by the schema when it was introduced.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2121276
> Fixes: 152c165d34cb6dcd21d08427422850f406cd0643
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/conf/schemas/domaincommon.rng   |  7 +++++++
>  src/conf/schemas/domainsnapshot.rng |  5 +++++
>  src/conf/schemas/inactiveDomain.rng | 10 ++++++++++
>  3 files changed, 22 insertions(+)
>  create mode 100644 src/conf/schemas/inactiveDomain.rng
> 

Again, meson.build might be also interested in learning about this new file:

diff --git i/src/conf/schemas/meson.build w/src/conf/schemas/meson.build
index 1bb09b4c5d..9ec4c010d6 100644
--- i/src/conf/schemas/meson.build
+++ w/src/conf/schemas/meson.build
@@ -10,6 +10,7 @@ schema_files = [
   'domain.rng',
   'domainoverrides.rng',
   'domainsnapshot.rng',
+  'inactiveDomain.rng',
   'interface.rng',
   'networkcommon.rng',
   'networkport.rng',

Michal