[libvirt] [PATCH 04/14] docs: schemas: Extract RBD-specific data

Peter Krempa posted 14 patches 8 years, 9 months ago
[libvirt] [PATCH 04/14] docs: schemas: Extract RBD-specific data
Posted by Peter Krempa 8 years, 9 months ago
RBD driver supports specifying a snapshot image name or config file.
Create a define for RBD and move the specifics there.
---
 docs/schemas/domaincommon.rng | 50 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index eca479594..05efea7f2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1521,24 +1521,12 @@
     </element>
   </define>

-  <define name="diskSourceNetwork">
-    <attribute name="type">
-      <value>network</value>
-    </attribute>
+  <define name="diskSourceNetworkProtocolRBD">
     <element name="source">
       <interleave>
         <attribute name="protocol">
           <choice>
-            <value>nbd</value>
             <value>rbd</value>
-            <value>sheepdog</value>
-            <value>gluster</value>
-            <value>iscsi</value>
-            <value>http</value>
-            <value>https</value>
-            <value>ftp</value>
-            <value>ftps</value>
-            <value>tftp</value>
           </choice>
         </attribute>
         <optional>
@@ -1568,6 +1556,42 @@
     </element>
   </define>

+  <define name="diskSourceNetworkProtocolGeneric">
+    <element name="source">
+      <interleave>
+        <attribute name="protocol">
+          <choice>
+            <value>nbd</value>
+            <value>sheepdog</value>
+            <value>gluster</value>
+            <value>iscsi</value>
+            <value>http</value>
+            <value>https</value>
+            <value>ftp</value>
+            <value>ftps</value>
+            <value>tftp</value>
+          </choice>
+        </attribute>
+        <optional>
+          <attribute name="name"/>
+        </optional>
+        <zeroOrMore>
+          <ref name="diskSourceNetworkHost"/>
+        </zeroOrMore>
+      </interleave>
+    </element>
+  </define>
+
+  <define name="diskSourceNetwork">
+    <attribute name="type">
+      <value>network</value>
+    </attribute>
+    <choice>
+      <ref name="diskSourceNetworkProtocolGeneric"/>
+      <ref name="diskSourceNetworkProtocolRBD"/>
+    </choice>
+  </define>
+
   <define name="diskSourceVolume">
     <attribute name="type">
       <value>volume</value>
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/14] docs: schemas: Extract RBD-specific data
Posted by Jiri Denemark 8 years, 9 months ago
On Wed, Apr 26, 2017 at 19:52:34 +0200, Peter Krempa wrote:
> RBD driver supports specifying a snapshot image name or config file.
> Create a define for RBD and move the specifics there.
> ---
>  docs/schemas/domaincommon.rng | 50 ++++++++++++++++++++++++++++++++-----------
>  1 file changed, 37 insertions(+), 13 deletions(-)
> 
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index eca479594..05efea7f2 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
...
> @@ -1568,6 +1556,42 @@
>      </element>
>    </define>
> 
> +  <define name="diskSourceNetworkProtocolGeneric">
> +    <element name="source">
> +      <interleave>
> +        <attribute name="protocol">
> +          <choice>
> +            <value>nbd</value>
> +            <value>sheepdog</value>
> +            <value>gluster</value>
> +            <value>iscsi</value>
> +            <value>http</value>
> +            <value>https</value>
> +            <value>ftp</value>
> +            <value>ftps</value>
> +            <value>tftp</value>
> +          </choice>
> +        </attribute>
> +        <optional>
> +          <attribute name="name"/>
> +        </optional>
> +        <zeroOrMore>
> +          <ref name="diskSourceNetworkHost"/>
> +        </zeroOrMore>
> +      </interleave>
> +    </element>
> +  </define>

The <interleave> is redundant here as attributes are implicitly
interleaved and there's only a single <host> element in addition to
them.

> +
> +  <define name="diskSourceNetwork">
> +    <attribute name="type">
> +      <value>network</value>
> +    </attribute>
> +    <choice>
> +      <ref name="diskSourceNetworkProtocolGeneric"/>
> +      <ref name="diskSourceNetworkProtocolRBD"/>
> +    </choice>
> +  </define>
> +

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/14] docs: schemas: Extract RBD-specific data
Posted by Peter Krempa 8 years, 9 months ago
On Thu, Apr 27, 2017 at 16:48:17 +0200, Jiri Denemark wrote:
> On Wed, Apr 26, 2017 at 19:52:34 +0200, Peter Krempa wrote:
> > RBD driver supports specifying a snapshot image name or config file.
> > Create a define for RBD and move the specifics there.
> > ---
> >  docs/schemas/domaincommon.rng | 50 ++++++++++++++++++++++++++++++++-----------
> >  1 file changed, 37 insertions(+), 13 deletions(-)
> > 
> > diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> > index eca479594..05efea7f2 100644
> > --- a/docs/schemas/domaincommon.rng
> > +++ b/docs/schemas/domaincommon.rng
> ...
> > @@ -1568,6 +1556,42 @@
> >      </element>
> >    </define>
> > 
> > +  <define name="diskSourceNetworkProtocolGeneric">
> > +    <element name="source">
> > +      <interleave>
> > +        <attribute name="protocol">
> > +          <choice>
> > +            <value>nbd</value>
> > +            <value>sheepdog</value>
> > +            <value>gluster</value>
> > +            <value>iscsi</value>
> > +            <value>http</value>
> > +            <value>https</value>
> > +            <value>ftp</value>
> > +            <value>ftps</value>
> > +            <value>tftp</value>
> > +          </choice>
> > +        </attribute>
> > +        <optional>
> > +          <attribute name="name"/>
> > +        </optional>
> > +        <zeroOrMore>
> > +          <ref name="diskSourceNetworkHost"/>
> > +        </zeroOrMore>
> > +      </interleave>
> > +    </element>
> > +  </define>
> 
> The <interleave> is redundant here as attributes are implicitly
> interleaved and there's only a single <host> element in addition to
> them.

This is a diff quirk. I did not touch this part, I just renamed it.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list