[libvirt] [PATCH] docs: schema: make disk driver name attribute optional

Jim Fehlig posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170718174227.3294-1-jfehlig@suse.com
docs/schemas/domaincommon.rng | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
[libvirt] [PATCH] docs: schema: make disk driver name attribute optional
Posted by Jim Fehlig 6 years, 9 months ago
/domain/devices/disk/driver/@name is not a required or mandatory
attribute according to formatdomain, and indeed it was agreed on
IRC that the attribute is "optional for input, recommended (but
not required) for output". Currently the schema requires the
attribute, causing virt-xml-validate to fail on disk config where
the driver name is not explicitly specified. E.g.

# cat test.xml | grep -A 5 cdrom
    <disk type='file' device='cdrom'>
      <driver type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

# virt-xml-validate test.xml
Relax-NG validity error : Extra element devices in interleave
test.xml:21: element devices: Relax-NG validity error : Element domain failed to validate content
test.xml fails to validate

Relaxing the name attribute to be optional fixes the validation

# virt-xml-validate test.xml
test.xml validates

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 docs/schemas/domaincommon.rng | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index fc1a40f96..a49ce9303 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1804,9 +1804,11 @@
     </element>
   </define>
   <define name="driverFormat">
-    <attribute name="name">
-      <ref name="genericName"/>
-    </attribute>
+    <optional>
+      <attribute name="name">
+        <ref name="genericName"/>
+      </attribute>
+    </optional>
     <optional>
       <attribute name='type'>
         <choice>
-- 
2.13.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: schema: make disk driver name attribute optional
Posted by Laine Stump 6 years, 9 months ago
On 07/18/2017 01:42 PM, Jim Fehlig wrote:
> /domain/devices/disk/driver/@name is not a required or mandatory
> attribute according to formatdomain, and indeed it was agreed on
> IRC that the attribute is "optional for input, recommended (but
> not required) for output". Currently the schema requires the
> attribute, causing virt-xml-validate to fail on disk config where
> the driver name is not explicitly specified. E.g.
>
> # cat test.xml | grep -A 5 cdrom
>     <disk type='file' device='cdrom'>
>       <driver type='raw'/>
>       <target dev='hdb' bus='ide'/>
>       <readonly/>
>       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
>     </disk>
>
> # virt-xml-validate test.xml
> Relax-NG validity error : Extra element devices in interleave
> test.xml:21: element devices: Relax-NG validity error : Element domain failed to validate content
> test.xml fails to validate
>
> Relaxing the name attribute to be optional fixes the validation
>
> # virt-xml-validate test.xml
> test.xml validates
>
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  docs/schemas/domaincommon.rng | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index fc1a40f96..a49ce9303 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1804,9 +1804,11 @@
>      </element>
>    </define>
>    <define name="driverFormat">
> -    <attribute name="name">
> -      <ref name="genericName"/>
> -    </attribute>
> +    <optional>
> +      <attribute name="name">
> +        <ref name="genericName"/>
> +      </attribute>
> +    </optional>
>      <optional>
>        <attribute name='type'>
>          <choice>

ACK

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: schema: make disk driver name attribute optional
Posted by Jim Fehlig 6 years, 9 months ago
On 07/18/2017 03:18 PM, Laine Stump wrote:
> On 07/18/2017 01:42 PM, Jim Fehlig wrote:
>> /domain/devices/disk/driver/@name is not a required or mandatory
>> attribute according to formatdomain, and indeed it was agreed on
>> IRC that the attribute is "optional for input, recommended (but
>> not required) for output". Currently the schema requires the
>> attribute, causing virt-xml-validate to fail on disk config where
>> the driver name is not explicitly specified. E.g.
>>
>> # cat test.xml | grep -A 5 cdrom
>>      <disk type='file' device='cdrom'>
>>        <driver type='raw'/>
>>        <target dev='hdb' bus='ide'/>
>>        <readonly/>
>>        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
>>      </disk>
>>
>> # virt-xml-validate test.xml
>> Relax-NG validity error : Extra element devices in interleave
>> test.xml:21: element devices: Relax-NG validity error : Element domain failed to validate content
>> test.xml fails to validate
>>
>> Relaxing the name attribute to be optional fixes the validation
>>
>> # virt-xml-validate test.xml
>> test.xml validates
>>
>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>> ---
>>   docs/schemas/domaincommon.rng | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
>> index fc1a40f96..a49ce9303 100644
>> --- a/docs/schemas/domaincommon.rng
>> +++ b/docs/schemas/domaincommon.rng
>> @@ -1804,9 +1804,11 @@
>>       </element>
>>     </define>
>>     <define name="driverFormat">
>> -    <attribute name="name">
>> -      <ref name="genericName"/>
>> -    </attribute>
>> +    <optional>
>> +      <attribute name="name">
>> +        <ref name="genericName"/>
>> +      </attribute>
>> +    </optional>
>>       <optional>
>>         <attribute name='type'>
>>           <choice>
> 
> ACK

Thanks, pushed now.

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list