[PATCH v4 6/9] conf: Fix virttype handling in schemas

Praveen K Paladugu posted 9 patches 1 week, 6 days ago
[PATCH v4 6/9] conf: Fix virttype handling in schemas
Posted by Praveen K Paladugu 1 week, 6 days ago
From: Praveen K Paladugu <prapal@linux.microsoft.com>

Create a common `virttype` definition in basictypes.rng and reuse it
to enumerate all virt types. This change eliminates the need to duplicate
virttypes in mulitple locations.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
---
 src/conf/schemas/basictypes.rng   | 22 ++++++++++++++++++++++
 src/conf/schemas/capability.rng   | 14 +-------------
 src/conf/schemas/domaincommon.rng | 23 +----------------------
 3 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/src/conf/schemas/basictypes.rng b/src/conf/schemas/basictypes.rng
index 2931e316b7..5689170fad 100644
--- a/src/conf/schemas/basictypes.rng
+++ b/src/conf/schemas/basictypes.rng
@@ -677,4 +677,26 @@
     </element>
   </define>
 
+  <define name="virttype">
+    <attribute name="type">
+      <choice>
+        <value>qemu</value>
+        <value>kqemu</value>
+        <value>kvm</value>
+        <value>xen</value>
+        <value>lxc</value>
+        <value>uml</value> <!-- NOT USED ANYMORE -->
+        <value>openvz</value>
+        <value>test</value>
+        <value>vmware</value>
+        <value>hyperv</value>
+        <value>vbox</value>
+        <value>phyp</value> <!-- NOT USED ANYMORE -->
+        <value>vz</value>
+        <value>bhyve</value>
+        <value>hvf</value>
+      </choice>
+    </attribute>
+  </define>
+
 </grammar>
diff --git a/src/conf/schemas/capability.rng b/src/conf/schemas/capability.rng
index a1606941e7..8ef6e9a282 100644
--- a/src/conf/schemas/capability.rng
+++ b/src/conf/schemas/capability.rng
@@ -421,19 +421,7 @@
 
   <define name="domain">
     <element name="domain">
-      <attribute name="type">
-        <choice>
-          <value>qemu</value>
-          <value>kqemu</value>
-          <value>kvm</value>
-          <value>xen</value>
-          <value>uml</value> <!-- NOT USED ANYMORE -->
-          <value>lxc</value>
-          <value>openvz</value>
-          <value>test</value>
-          <value>hvf</value>
-        </choice>
-      </attribute>
+      <ref name="virttype"/>
 
       <optional>
         <ref name="emulator"/>
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 75b5124c33..858d61d8be 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -32,7 +32,7 @@
   </define>
 
   <define name="domaincontents">
-    <ref name="hvs"/>
+    <ref name="virttype"/>
     <optional>
       <attribute name="id">
         <ref name="unsignedInt"/>
@@ -241,27 +241,6 @@
       </choice>
     </element>
   </define>
-  <define name="hvs">
-    <attribute name="type">
-      <choice>
-        <value>qemu</value>
-        <value>kqemu</value>
-        <value>kvm</value>
-        <value>xen</value>
-        <value>lxc</value>
-        <value>uml</value> <!-- NOT USED ANYMORE -->
-        <value>openvz</value>
-        <value>test</value>
-        <value>vmware</value>
-        <value>hyperv</value>
-        <value>vbox</value>
-        <value>phyp</value> <!-- NOT USED ANYMORE -->
-        <value>vz</value>
-        <value>bhyve</value>
-        <value>hvf</value>
-      </choice>
-    </attribute>
-  </define>
   <define name="os">
     <choice>
       <ref name="osxen"/>
-- 
2.51.0
Re: [PATCH v4 6/9] conf: Fix virttype handling in schemas
Posted by Martin Kletzander via Devel 2 hours ago
On Fri, Nov 07, 2025 at 02:13:57PM -0600, Praveen K Paladugu wrote:
>From: Praveen K Paladugu <prapal@linux.microsoft.com>
>
>Create a common `virttype` definition in basictypes.rng and reuse it
>to enumerate all virt types. This change eliminates the need to duplicate
>virttypes in mulitple locations.

s/mulitple/multiple/

>
>Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>