[PATCH 1/6] schema: domain: Allow interleave of 'smartcard' subelements

Peter Krempa pkrempa at redhat.com
Wed Feb 1 16:03:48 UTC 2023


Allow interleave of the top level sub-elements as well as the
subelements in the 'host-certificates' mode. Note that '<interleave>'
doesn't work properly if there's multiple definitions of the same
sub-element in the interleave so for this patch I chose to '<group>' the
'certificate' subelements. Another options would require us to stop
enforcing that there's exactly 3 of them.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/schemas/domaincommon.rng | 86 +++++++++++++++++--------------
 1 file changed, 47 insertions(+), 39 deletions(-)

diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index b4731f0d8d..f966285641 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -5559,49 +5559,57 @@
       </interleave>
     </element>
   </define>
+
   <define name="smartcard">
     <element name="smartcard">
-      <choice>
-        <group>
-          <attribute name="mode">
-            <value>host</value>
-          </attribute>
-          <!-- might need to add optional database element here later -->
-        </group>
-        <group>
-          <attribute name="mode">
-            <value>host-certificates</value>
-          </attribute>
-          <ref name="certificate"/>
-          <ref name="certificate"/>
-          <ref name="certificate"/>
-          <optional>
-            <element name="database">
-              <ref name="absDirPath"/>
-            </element>
-          </optional>
-        </group>
-        <group>
-          <attribute name="mode">
-            <value>passthrough</value>
-          </attribute>
-          <ref name="qemucdevSrcType"/>
-          <interleave>
-            <ref name="qemucdevSrcDef"/>
-            <optional>
-              <ref name="qemucdevTgtDef"/>
-            </optional>
-          </interleave>
-        </group>
-      </choice>
-      <optional>
-        <ref name="acpi"/>
-      </optional>
-      <optional>
-        <ref name="address"/>
-      </optional>
+      <interleave>
+        <choice>
+          <group>
+            <attribute name="mode">
+              <value>host</value>
+            </attribute>
+            <!-- might need to add optional database element here later -->
+          </group>
+          <group>
+            <interleave>
+              <attribute name="mode">
+                <value>host-certificates</value>
+              </attribute>
+              <group>
+                <ref name="certificate"/>
+                <ref name="certificate"/>
+                <ref name="certificate"/>
+              </group>
+              <optional>
+                <element name="database">
+                  <ref name="absDirPath"/>
+                </element>
+              </optional>
+            </interleave>
+          </group>
+          <group>
+            <attribute name="mode">
+              <value>passthrough</value>
+            </attribute>
+            <ref name="qemucdevSrcType"/>
+            <interleave>
+              <ref name="qemucdevSrcDef"/>
+              <optional>
+                <ref name="qemucdevTgtDef"/>
+              </optional>
+            </interleave>
+          </group>
+        </choice>
+        <optional>
+          <ref name="acpi"/>
+        </optional>
+        <optional>
+          <ref name="address"/>
+        </optional>
+      </interleave>
     </element>
   </define>
+
   <define name="certificate">
     <element name="certificate">
       <text/>
-- 
2.39.1



More information about the libvir-list mailing list