[libvirt] [PATCH v2 1/3] schemas: finish virTristate{Bool, Switch} transition

Martin Kletzander mkletzan at redhat.com
Mon Sep 15 13:20:19 UTC 2014


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---

Notes:
    v2:
     - s/virBool/virYesNo/
     - s/virSwitch/virOnOff/

 docs/schemas/basictypes.rng   |  19 ++++--
 docs/schemas/capability.rng   |  10 +--
 docs/schemas/domaincaps.rng   |   5 +-
 docs/schemas/domaincommon.rng | 155 +++++++++---------------------------------
 docs/schemas/interface.rng    |  19 +-----
 docs/schemas/network.rng      |  29 ++------
 docs/schemas/nwfilter.rng     |   5 +-
 docs/schemas/secret.rng       |  10 +--
 8 files changed, 61 insertions(+), 191 deletions(-)

diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 75d5238..14245c9 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -77,10 +77,7 @@
     </attribute>
     <optional>
       <attribute name="multifunction">
-        <choice>
-          <value>on</value>
-          <value>off</value>
-        </choice>
+        <ref name="virOnOff"/>
       </attribute>
     </optional>
   </define>
@@ -446,4 +443,18 @@
     </optional>
   </define>

+  <define name="virYesNo">
+    <choice>
+      <value>yes</value>
+      <value>no</value>
+    </choice>
+  </define>
+
+  <define name="virOnOff">
+    <choice>
+      <value>on</value>
+      <value>off</value>
+    </choice>
+  </define>
+
 </grammar>
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index f954599..5f3ec70 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -405,16 +405,10 @@

   <define name='featuretoggle'>
     <attribute name='toggle'>
-      <choice>
-        <value>yes</value>
-        <value>no</value>
-      </choice>
+      <ref name="virYesNo"/>
     </attribute>
     <attribute name='default'>
-      <choice>
-        <value>on</value>
-        <value>off</value>
-      </choice>
+      <ref name="virOnOff"/>
     </attribute>
   </define>

diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
index 627b699..72e19f1 100644
--- a/docs/schemas/domaincaps.rng
+++ b/docs/schemas/domaincaps.rng
@@ -66,10 +66,7 @@

   <define name='supported'>
     <attribute name='supported'>
-      <choice>
-        <value>yes</value>
-        <value>no</value>
-      </choice>
+      <ref name="virYesNo"/>
     </attribute>
   </define>

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6ae940a..a024602 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -118,10 +118,7 @@
           </attribute>
           <optional>
             <attribute name='relabel'>
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <interleave>
@@ -282,10 +279,7 @@
         <optional>
           <element name="bootmenu">
             <attribute name="enable">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
             <optional>
               <attribute name="timeout">
@@ -584,10 +578,7 @@
         <ref name='scaledInteger'/>
         <optional>
           <attribute name="dumpCore">
-            <choice>
-              <value>on</value>
-              <value>off</value>
-            </choice>
+            <ref name="virOnOff"/>
           </attribute>
         </optional>
       </element>
@@ -1000,10 +991,7 @@
       </choice>
       <optional>
         <attribute name="present">
-          <choice>
-            <value>yes</value>
-            <value>no</value>
-          </choice>
+          <ref name="virYesNo"/>
         </attribute>
       </optional>
       <empty/>
@@ -1253,10 +1241,7 @@
           </attribute>
           <optional>
             <attribute name="rawio">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
@@ -1524,10 +1509,7 @@
       </optional>
       <optional>
         <attribute name="removable">
-          <choice>
-            <value>on</value>
-            <value>off</value>
-          </choice>
+          <ref name="virOnOff"/>
         </attribute>
       </optional>
     </element>
@@ -1660,26 +1642,17 @@
   </define>
   <define name="ioeventfd">
     <attribute name="ioeventfd">
-      <choice>
-        <value>on</value>
-        <value>off</value>
-      </choice>
+      <ref name="virOnOff"/>
     </attribute>
   </define>
   <define name="event_idx">
     <attribute name="event_idx">
-      <choice>
-        <value>on</value>
-        <value>off</value>
-      </choice>
+      <ref name="virOnOff"/>
     </attribute>
   </define>
   <define name="copy_on_read">
     <attribute name='copy_on_read'>
-      <choice>
-        <value>on</value>
-        <value>off</value>
-      </choice>
+      <ref name="virOnOff"/>
     </attribute>
     </define>
   <define name="discard">
@@ -2210,20 +2183,14 @@
           </attribute>
           <optional>
             <attribute name="managed">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <interleave>
             <element name="source">
               <optional>
                 <attribute name="missing">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
               </optional>
               <choice>
@@ -2446,10 +2413,7 @@
           </optional>
           <optional>
             <attribute name="fullscreen">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
         </group>
@@ -2466,10 +2430,7 @@
               </optional>
               <optional>
                 <attribute name="autoport">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
               </optional>
               <optional>
@@ -2540,10 +2501,7 @@
           </optional>
           <optional>
             <attribute name="autoport">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
@@ -2652,10 +2610,7 @@
             <optional>
               <element name="playback">
                 <attribute name="compression">
-                  <choice>
-                    <value>on</value>
-                    <value>off</value>
-                  </choice>
+                  <ref name="virOnOff"/>
                 </attribute>
                 <empty/>
               </element>
@@ -2675,10 +2630,7 @@
             <optional>
               <element name="clipboard">
                 <attribute name="copypaste">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
                 <empty/>
               </element>
@@ -2697,10 +2649,7 @@
             <optional>
               <element name="filetransfer">
                 <attribute name="enable">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
                 <empty/>
               </element>
@@ -2718,26 +2667,17 @@
           </optional>
           <optional>
             <attribute name="autoport">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
             <attribute name="replaceUser">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
             <attribute name="multiUser">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
@@ -2758,10 +2698,7 @@
           </optional>
           <optional>
             <attribute name="fullscreen">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
         </group>
@@ -2840,28 +2777,19 @@
           </optional>
           <optional>
             <attribute name="primary">
-              <choice>
-                <value>yes</value>
-                <value>no</value>
-              </choice>
+              <ref name="virYesNo"/>
             </attribute>
           </optional>
           <optional>
             <element name="acceleration">
               <optional>
                 <attribute name="accel3d">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
               </optional>
               <optional>
                 <attribute name="accel2d">
-                  <choice>
-                    <value>yes</value>
-                    <value>no</value>
-                  </choice>
+                  <ref name="virYesNo"/>
                 </attribute>
               </optional>
             </element>
@@ -2987,10 +2915,7 @@
   <define name="suspendChoices">
     <optional>
       <attribute name="enabled">
-        <choice>
-          <value>yes</value>
-          <value>no</value>
-        </choice>
+        <ref name="virYesNo"/>
       </attribute>
     </optional>
   </define>
@@ -3082,10 +3007,7 @@
   <define name="usbdevfilter">
     <element name="usbdev">
       <attribute name="allow">
-        <choice>
-          <value>yes</value>
-          <value>no</value>
-        </choice>
+        <ref name="virYesNo"/>
       </attribute>
       <optional>
         <attribute name="class">
@@ -3545,10 +3467,7 @@
     </optional>
     <optional>
       <attribute name="managed">
-        <choice>
-          <value>yes</value>
-          <value>no</value>
-        </choice>
+        <ref name="virYesNo"/>
       </attribute>
     </optional>
     <choice>
@@ -3888,10 +3807,7 @@
             <element name="apic">
               <optional>
                 <attribute name="eoi">
-                  <choice>
-                    <value>on</value>
-                    <value>off</value>
-                  </choice>
+                  <ref name="virOnOff"/>
                 </attribute>
               </optional>
             </element>
@@ -4185,10 +4101,7 @@
     <element name="bios">
       <optional>
         <attribute name="useserial">
-          <choice>
-            <value>yes</value>
-            <value>no</value>
-          </choice>
+          <ref name="virYesNo"/>
         </attribute>
       </optional>
       <optional>
@@ -4258,10 +4171,7 @@
     <element name="rom">
       <optional>
         <attribute name="bar">
-          <choice>
-            <value>on</value>
-            <value>off</value>
-          </choice>
+          <ref name="virOnOff"/>
         </attribute>
       </optional>
       <optional>
@@ -4731,10 +4641,7 @@

   <define name="featurestate">
     <attribute name="state">
-      <choice>
-        <value>on</value>
-        <value>off</value>
-      </choice>
+      <ref name="virOnOff"/>
     </attribute>
   </define>

diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng
index 0f577d6..d78f877 100644
--- a/docs/schemas/interface.rng
+++ b/docs/schemas/interface.rng
@@ -127,7 +127,7 @@
         <element name="bridge">
           <optional>
             <attribute name="stp">
-              <ref name="on-or-off"/>
+              <ref name="virOnOff"/>
             </attribute>
           </optional>
           <!-- Bridge forward delay (see 'brctl setfd') -->
@@ -376,7 +376,7 @@
     <element name="dhcp">
       <optional>
         <attribute name="peerdns">
-          <ref name="yes-or-no"/>
+          <ref name="virYesNo"/>
         </attribute>
       </optional>
     </element>
@@ -415,21 +415,6 @@
        instead of destination and nexthop instead of gateway.
   -->

-  <!-- Auxiliary definitions -->
-  <define name="on-or-off">
-    <choice>
-      <value>on</value>
-      <value>off</value>
-    </choice>
-  </define>
-
-  <define name="yes-or-no">
-    <choice>
-      <value>yes</value>
-      <value>no</value>
-    </choice>
-  </define>
-
   <!-- Type library -->

   <define name="timeval">
diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 0e7da89..d84ccc0 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -21,12 +21,9 @@
            with no gateways addresses specified -->
       <optional>
         <attribute name="ipv6">
-         <choice>
-          <value>yes</value>
-          <value>no</value>
-          </choice>
-         </attribute>
-       </optional>
+          <ref name="virYesNo"/>
+        </attribute>
+      </optional>
       <interleave>

         <!-- The name of the network, used to refer to it through the API
@@ -53,10 +50,7 @@

             <optional>
               <attribute name="stp">
-                <choice>
-                  <value>on</value>
-                  <value>off</value>
-                </choice>
+                <ref name="virOnOff"/>
               </attribute>
             </optional>

@@ -104,10 +98,7 @@

             <optional>
               <attribute name="managed">
-                <choice>
-                  <value>yes</value>
-                  <value>no</value>
-                </choice>
+                <ref name="virYesNo"/>
               </attribute>
             </optional>
             <interleave>
@@ -203,10 +194,7 @@
             </attribute>
             <optional>
               <attribute name="default">
-                <choice>
-                  <value>yes</value>
-                  <value>no</value>
-                </choice>
+                <ref name="virYesNo"/>
               </attribute>
             </optional>
             <interleave>
@@ -236,10 +224,7 @@
           <element name="dns">
             <optional>
               <attribute name="forwardPlainNames">
-                <choice>
-                  <value>yes</value>
-                  <value>no</value>
-                </choice>
+                <ref name="virYesNo"/>
               </attribute>
             </optional>
             <interleave>
diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng
index f1aa699..2b54fd5 100644
--- a/docs/schemas/nwfilter.rng
+++ b/docs/schemas/nwfilter.rng
@@ -377,10 +377,7 @@
     <interleave>
       <optional>
          <attribute name="match">
-           <choice>
-             <value>yes</value>
-             <value>no</value>
-           </choice>
+           <ref name="virYesNo"/>
          </attribute>
       </optional>
     </interleave>
diff --git a/docs/schemas/secret.rng b/docs/schemas/secret.rng
index d7b8f83..e21e700 100644
--- a/docs/schemas/secret.rng
+++ b/docs/schemas/secret.rng
@@ -11,18 +11,12 @@
     <element name='secret'>
       <optional>
         <attribute name='ephemeral'>
-          <choice>
-            <value>yes</value>
-            <value>no</value>
-          </choice>
+          <ref name="virYesNo"/>
         </attribute>
       </optional>
       <optional>
         <attribute name='private'>
-          <choice>
-            <value>yes</value>
-            <value>no</value>
-          </choice>
+          <ref name="virYesNo"/>
         </attribute>
       </optional>
       <interleave>
-- 
2.1.0




More information about the libvir-list mailing list