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

Laine Stump laine at laine.org
Thu Sep 11 13:54:51 UTC 2014


On 09/08/2014 07:40 AM, Martin Kletzander wrote:
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  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..d26da57 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="virSwitch"/>

Purely cosmetic, but how about calling them "virYesNo" and "virOnOff" to
avoid confusion? When I see "virBool" I think "true/false", and when I
see "virSwitch" I think "Does this have something to do with a network
device?" :-)

>        </attribute>
>      </optional>
>    </define>
> @@ -446,4 +443,18 @@
>      </optional>
>    </define>
>
> +  <define name="virBool">
> +    <choice>
> +      <value>yes</value>
> +      <value>no</value>
> +    </choice>
> +  </define>
> +
> +  <define name="virSwitch">
> +    <choice>
> +      <value>on</value>
> +      <value>off</value>
> +    </choice>
> +  </define>
> +
>  </grammar>
> diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
> index f954599..65a8a0d 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="virBool"/>
>      </attribute>
>      <attribute name='default'>
> -      <choice>
> -        <value>on</value>
> -        <value>off</value>
> -      </choice>
> +      <ref name="virSwitch"/>
>      </attribute>
>    </define>
>
> diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng
> index 627b699..bc36a28 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="virBool"/>
>      </attribute>
>    </define>
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index cedceae..25ff386 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="virBool"/>
>              </attribute>
>            </optional>
>            <interleave>
> @@ -254,10 +251,7 @@
>          <optional>
>            <element name="bootmenu">
>              <attribute name="enable">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>              <optional>
>                <attribute name="timeout">
> @@ -556,10 +550,7 @@
>          <ref name='scaledInteger'/>
>          <optional>
>            <attribute name="dumpCore">
> -            <choice>
> -              <value>on</value>
> -              <value>off</value>
> -            </choice>
> +            <ref name="virSwitch"/>
>            </attribute>
>          </optional>
>        </element>
> @@ -972,10 +963,7 @@
>        </choice>
>        <optional>
>          <attribute name="present">
> -          <choice>
> -            <value>yes</value>
> -            <value>no</value>
> -          </choice>
> +          <ref name="virBool"/>
>          </attribute>
>        </optional>
>        <empty/>
> @@ -1225,10 +1213,7 @@
>            </attribute>
>            <optional>
>              <attribute name="rawio">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
> @@ -1496,10 +1481,7 @@
>        </optional>
>        <optional>
>          <attribute name="removable">
> -          <choice>
> -            <value>on</value>
> -            <value>off</value>
> -          </choice>
> +          <ref name="virSwitch"/>
>          </attribute>
>        </optional>
>      </element>
> @@ -1632,26 +1614,17 @@
>    </define>
>    <define name="ioeventfd">
>      <attribute name="ioeventfd">
> -      <choice>
> -        <value>on</value>
> -        <value>off</value>
> -      </choice>
> +      <ref name="virSwitch"/>
>      </attribute>
>    </define>
>    <define name="event_idx">
>      <attribute name="event_idx">
> -      <choice>
> -        <value>on</value>
> -        <value>off</value>
> -      </choice>
> +      <ref name="virSwitch"/>
>      </attribute>
>    </define>
>    <define name="copy_on_read">
>      <attribute name='copy_on_read'>
> -      <choice>
> -        <value>on</value>
> -        <value>off</value>
> -      </choice>
> +      <ref name="virSwitch"/>
>      </attribute>
>      </define>
>    <define name="discard">
> @@ -2182,20 +2155,14 @@
>            </attribute>
>            <optional>
>              <attribute name="managed">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <interleave>
>              <element name="source">
>                <optional>
>                  <attribute name="missing">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                </optional>
>                <choice>
> @@ -2418,10 +2385,7 @@
>            </optional>
>            <optional>
>              <attribute name="fullscreen">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>          </group>
> @@ -2438,10 +2402,7 @@
>                </optional>
>                <optional>
>                  <attribute name="autoport">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                </optional>
>                <optional>
> @@ -2512,10 +2473,7 @@
>            </optional>
>            <optional>
>              <attribute name="autoport">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
> @@ -2624,10 +2582,7 @@
>              <optional>
>                <element name="playback">
>                  <attribute name="compression">
> -                  <choice>
> -                    <value>on</value>
> -                    <value>off</value>
> -                  </choice>
> +                  <ref name="virSwitch"/>
>                  </attribute>
>                  <empty/>
>                </element>
> @@ -2647,10 +2602,7 @@
>              <optional>
>                <element name="clipboard">
>                  <attribute name="copypaste">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                  <empty/>
>                </element>
> @@ -2669,10 +2621,7 @@
>              <optional>
>                <element name="filetransfer">
>                  <attribute name="enable">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                  <empty/>
>                </element>
> @@ -2690,26 +2639,17 @@
>            </optional>
>            <optional>
>              <attribute name="autoport">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
>              <attribute name="replaceUser">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
>              <attribute name="multiUser">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
> @@ -2730,10 +2670,7 @@
>            </optional>
>            <optional>
>              <attribute name="fullscreen">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>          </group>
> @@ -2812,28 +2749,19 @@
>            </optional>
>            <optional>
>              <attribute name="primary">
> -              <choice>
> -                <value>yes</value>
> -                <value>no</value>
> -              </choice>
> +              <ref name="virBool"/>
>              </attribute>
>            </optional>
>            <optional>
>              <element name="acceleration">
>                <optional>
>                  <attribute name="accel3d">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                </optional>
>                <optional>
>                  <attribute name="accel2d">
> -                  <choice>
> -                    <value>yes</value>
> -                    <value>no</value>
> -                  </choice>
> +                  <ref name="virBool"/>
>                  </attribute>
>                </optional>
>              </element>
> @@ -2959,10 +2887,7 @@
>    <define name="suspendChoices">
>      <optional>
>        <attribute name="enabled">
> -        <choice>
> -          <value>yes</value>
> -          <value>no</value>
> -        </choice>
> +        <ref name="virBool"/>
>        </attribute>
>      </optional>
>    </define>
> @@ -3054,10 +2979,7 @@
>    <define name="usbdevfilter">
>      <element name="usbdev">
>        <attribute name="allow">
> -        <choice>
> -          <value>yes</value>
> -          <value>no</value>
> -        </choice>
> +        <ref name="virBool"/>
>        </attribute>
>        <optional>
>          <attribute name="class">
> @@ -3517,10 +3439,7 @@
>      </optional>
>      <optional>
>        <attribute name="managed">
> -        <choice>
> -          <value>yes</value>
> -          <value>no</value>
> -        </choice>
> +        <ref name="virBool"/>
>        </attribute>
>      </optional>
>      <choice>
> @@ -3860,10 +3779,7 @@
>              <element name="apic">
>                <optional>
>                  <attribute name="eoi">
> -                  <choice>
> -                    <value>on</value>
> -                    <value>off</value>
> -                  </choice>
> +                  <ref name="virSwitch"/>
>                  </attribute>
>                </optional>
>              </element>
> @@ -4157,10 +4073,7 @@
>      <element name="bios">
>        <optional>
>          <attribute name="useserial">
> -          <choice>
> -            <value>yes</value>
> -            <value>no</value>
> -          </choice>
> +          <ref name="virBool"/>
>          </attribute>
>        </optional>
>        <optional>
> @@ -4230,10 +4143,7 @@
>      <element name="rom">
>        <optional>
>          <attribute name="bar">
> -          <choice>
> -            <value>on</value>
> -            <value>off</value>
> -          </choice>
> +          <ref name="virSwitch"/>
>          </attribute>
>        </optional>
>        <optional>
> @@ -4703,10 +4613,7 @@
>
>    <define name="featurestate">
>      <attribute name="state">
> -      <choice>
> -        <value>on</value>
> -        <value>off</value>
> -      </choice>
> +      <ref name="virSwitch"/>
>      </attribute>
>    </define>
>
> diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng
> index 0f577d6..bf1c982 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="virSwitch"/>
>              </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="virBool"/>
>          </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..9f967a1 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="virBool"/>
> +        </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="virSwitch"/>
>                </attribute>
>              </optional>
>
> @@ -104,10 +98,7 @@
>
>              <optional>
>                <attribute name="managed">
> -                <choice>
> -                  <value>yes</value>
> -                  <value>no</value>
> -                </choice>
> +                <ref name="virBool"/>
>                </attribute>
>              </optional>
>              <interleave>
> @@ -203,10 +194,7 @@
>              </attribute>
>              <optional>
>                <attribute name="default">
> -                <choice>
> -                  <value>yes</value>
> -                  <value>no</value>
> -                </choice>
> +                <ref name="virBool"/>
>                </attribute>
>              </optional>
>              <interleave>
> @@ -236,10 +224,7 @@
>            <element name="dns">
>              <optional>
>                <attribute name="forwardPlainNames">
> -                <choice>
> -                  <value>yes</value>
> -                  <value>no</value>
> -                </choice>
> +                <ref name="virBool"/>
>                </attribute>
>              </optional>
>              <interleave>
> diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng
> index f1aa699..e057947 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="virBool"/>
>           </attribute>
>        </optional>
>      </interleave>
> diff --git a/docs/schemas/secret.rng b/docs/schemas/secret.rng
> index d7b8f83..c9035b6 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="virBool"/>
>          </attribute>
>        </optional>
>        <optional>
>          <attribute name='private'>
> -          <choice>
> -            <value>yes</value>
> -            <value>no</value>
> -          </choice>
> +          <ref name="virBool"/>
>          </attribute>
>        </optional>
>        <interleave>




More information about the libvir-list mailing list