]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
schema: Add define for object names
authorPeter Krempa <pkrempa@redhat.com>
Wed, 6 Jan 2021 15:51:21 +0000 (16:51 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 8 Jan 2021 08:18:21 +0000 (09:18 +0100)
Objects such as domain, pool, etc re-define the regex for the format.
Add more generic types for objects with/without a slash which we'll be
able to reuse also for other objects.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
docs/schemas/basictypes.rng
docs/schemas/domaincommon.rng
docs/schemas/storagecommon.rng
docs/schemas/storagepool.rng

index fc52799466592cd18cb170ef987475fccf3ab583..a221ff6295c05e7e3e013181fa1ac4b9e5f1877a 100644 (file)
     </choice>
   </define>
 
+  <!-- objectName represents any generic string for naming objects like domain -->
+  <define name="objectNameWithSlash">
+    <data type="string">
+      <param name="pattern">[^\n]+</param>
+    </data>
+  </define>
+
+  <define name="objectName">
+    <data type="string">
+      <param name="pattern">[^/\n]+</param>
+    </data>
+  </define>
+
   <define name="genericName">
     <data type="string">
       <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
index 39bed921159e6b640415212efa3bf91f3cc8f034..4fc6a7ee7ae1d24ac9fb9af98d2ddbf42cc7b0d9 100644 (file)
@@ -18,9 +18,7 @@
 
   <define name="title">
     <element name="title">
-      <data type="string">
-        <param name="pattern">[^\n]+</param>
-      </data>
+      <ref name="objectNameWithSlash"/>
     </element>
   </define>
 
     </optional>
     <interleave>
       <element name="name">
-        <ref name="domainName"/>
+        <ref name="objectNameWithSlash"/>
       </element>
       <optional>
         <element name="uuid">
       <optional>
         <element name="backenddomain">
           <attribute name="name">
-            <ref name="domainName"/>
+            <ref name="objectNameWithSlash"/>
           </attribute>
           <empty/>
         </element>
       <element name="source">
         <interleave>
           <attribute name="pool">
-            <ref name="poolName"/>
+            <ref name="objectName"/>
           </attribute>
           <attribute name="volume">
             <ref name="volName"/>
       <optional>
         <element name="backenddomain">
           <attribute name="name">
-            <ref name="domainName"/>
+            <ref name="objectNameWithSlash"/>
           </attribute>
           <empty/>
         </element>
       <param name="maxInclusive">1000</param>
     </data>
   </define>
-  <define name="domainName">
-    <data type="string">
-      <param name="pattern">[^\n]+</param>
-    </data>
-  </define>
   <define name="diskSerial">
     <data type="string">
       <param name="pattern">[A-Za-z0-9_\.\+\- ]+</param>
index 54619d4cb09d62370bb5a8be2d3cc7f898ba543c..e3d08a8410f9c27c65b54d5694dd09b0a78fa083 100644 (file)
@@ -6,12 +6,6 @@
   <!-- This schema is not designed for standalone use; another file
        must include both this file and basictypes.rng -->
 
-  <define name="poolName">
-    <data type="string">
-      <param name="pattern">[^/\n]+</param>
-    </data>
-  </define>
-
   <define name="encryption">
     <element name="encryption">
       <attribute name="format">
index a87d22f6fcf02eb149b8e96c691fc776210a5767..bd24b8b8d091293cea48b8675d0de4309e72c38a 100644 (file)
     <interleave>
       <optional>
         <element name="name">
-          <ref name="poolName"/>
+          <ref name="objectName"/>
         </element>
       </optional>
       <optional>
   <define name="commonmetadata">
     <interleave>
       <element name="name">
-        <ref name="poolName"/>
+        <ref name="objectName"/>
       </element>
       <optional>
         <element name="uuid">