]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
schema: Move host cpu definition to cputypes.rng
authorTim Wiederhake <twiederh@redhat.com>
Wed, 30 Sep 2020 11:54:59 +0000 (13:54 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 7 Oct 2020 07:18:07 +0000 (09:18 +0200)
This also inlines the defintions for "cpufeature", "cpuspec",
"featureName" and "pagesHost", as "cpu" was the only user.

Doing so avoids a naming collision when cputypes.rng is included in
other schemas in a later patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
docs/schemas/capability.rng
docs/schemas/cputypes.rng

index 68bdb2969518aa0ec625dc616143d5dd0fcb2be3..91a046eb48a4389a3a113bc3b83390fa06191685 100644 (file)
@@ -3,6 +3,7 @@
 <grammar xmlns="http://relaxng.org/ns/structure/1.0"
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
   <include href="basictypes.rng"/>
+  <include href="cputypes.rng"/>
   <start>
     <ref name="capabilities"/>
   </start>
           <ref name="UUID"/>
         </element>
       </optional>
-      <element name="cpu">
-        <element name="arch">
-          <ref name="archnames"/>
-        </element>
-        <optional>
-          <ref name="cpufeatures"/>
-        </optional>
-        <optional>
-          <ref name="cpuspec"/>
-        </optional>
-      </element>
+      <ref name="hostcpu"/>
       <optional>
         <ref name="power_management"/>
       </optional>
     </element>
   </define>
 
-
-  <define name="cpufeatures">
-    <element name="features">
-      <optional>
-        <element name="pae"><empty/></element>
-      </optional>
-      <optional>
-        <element name="nonpae"><empty/></element>
-      </optional>
-      <optional>
-        <element name="vmx"><empty/></element>
-      </optional>
-      <optional>
-        <element name="svm"><empty/></element>
-      </optional>
-    </element>
-  </define>
-
-  <define name="cpuspec">
-    <element name="model">
-      <text/>
-    </element>
-    <optional>
-      <element name="vendor">
-        <text/>
-      </element>
-    </optional>
-    <optional>
-      <element name="microcode">
-        <attribute name="version">
-          <ref name="positiveInteger"/>
-        </attribute>
-      </element>
-    </optional>
-    <element name="topology">
-      <attribute name="sockets">
-        <ref name="positiveInteger"/>
-      </attribute>
-      <attribute name="cores">
-        <ref name="positiveInteger"/>
-      </attribute>
-      <attribute name="threads">
-        <ref name="positiveInteger"/>
-      </attribute>
-    </element>
-    <zeroOrMore>
-      <element name="feature">
-        <attribute name="name">
-          <ref name="featureName"/>
-        </attribute>
-        <empty/>
-      </element>
-    </zeroOrMore>
-    <zeroOrMore>
-      <ref name="pagesHost"/>
-    </zeroOrMore>
-  </define>
-
   <define name="power_management">
     <element name="power_management">
       <interleave>
     </attribute>
   </define>
 
-  <define name="featureName">
-    <data type="string">
-      <param name="pattern">[a-zA-Z0-9\-_]+</param>
-    </data>
-  </define>
-
-  <define name="pagesHost">
-    <element name="pages">
-      <ref name="pagesElem"/>
-    </element>
-  </define>
   <define name="pagesNuma">
     <element name="pages">
       <ref name="pagesElem"/>
index e6e82b5fd2044aa76273337cb7003b7e1721258d..a2d4dbe9d157240345f66313229211cb340d6ea9 100644 (file)
     </element>
   </define>
 
+  <define name="hostcpu">
+    <element name="cpu">
+      <element name="arch">
+        <ref name="archnames"/>
+      </element>
+      <optional>
+        <element name="features">
+          <optional>
+            <element name="pae"><empty/></element>
+          </optional>
+          <optional>
+            <element name="nonpae"><empty/></element>
+          </optional>
+          <optional>
+            <element name="vmx"><empty/></element>
+          </optional>
+          <optional>
+            <element name="svm"><empty/></element>
+          </optional>
+        </element>
+      </optional>
+      <optional>
+        <element name="model">
+          <text/>
+        </element>
+        <optional>
+          <element name="vendor">
+            <text/>
+          </element>
+        </optional>
+        <optional>
+          <element name="microcode">
+            <attribute name="version">
+              <ref name="positiveInteger"/>
+            </attribute>
+          </element>
+        </optional>
+        <element name="topology">
+          <attribute name="sockets">
+            <ref name="positiveInteger"/>
+          </attribute>
+          <attribute name="cores">
+            <ref name="positiveInteger"/>
+          </attribute>
+          <attribute name="threads">
+            <ref name="positiveInteger"/>
+          </attribute>
+        </element>
+        <zeroOrMore>
+          <element name="feature">
+            <attribute name="name">
+              <data type="string">
+                <param name="pattern">[a-zA-Z0-9\-_]+</param>
+              </data>
+            </attribute>
+            <empty/>
+          </element>
+        </zeroOrMore>
+        <zeroOrMore>
+          <element name="pages">
+            <optional>
+              <attribute name="unit">
+                <ref name="unit"/>
+              </attribute>
+            </optional>
+            <attribute name="size">
+              <ref name="unsignedInt"/>
+            </attribute>
+          </element>
+        </zeroOrMore>
+      </optional>
+    </element>
+  </define>
+
 </grammar>