Bug 1572491

Summary: virt-xml-validate validate fails for capabilities and storagevol
Product: Red Hat Enterprise Linux 7 Reporter: yafu <yafu>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED ERRATA QA Contact: yafu <yafu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: dyuan, fjin, lmen, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-4.4.0-1.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 09:55:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yafu 2018-04-27 07:06:37 UTC
Description of problem:
virt-xml-validate validate fails for capabilities and storagevol

Version-Release number of selected component (if applicable):
libvirt-3.9.0-14.el7_5.4.x86_64

How reproducible:
100%

Steps to Reproduce:
1.#virsh capabilities > cap.xml
2.#virt-xml-validate cap.xml capability
cap.xml:9: element microcode: Relax-NG validity error : Did not expect element microcode there
cap.xml:49: element uri_transport: Relax-NG validity error : Error validating value 
cap.xml:49: element uri_transport: Relax-NG validity error : Element uri_transport failed to validate content
cap.xml fails to validate

3.#virsh vol-list default 
# virsh vol-list default
 Name                 Path                                    
------------------------------------------------------------------------------
test                 /var/lib/libvirt/images/test
...
4.#virsh vol-dumpxml test default > vol.xml
5.# virt-xml-validate vol.xml storagevol
vol.xml:1: element volume: Relax-NG validity error : Expecting an element target, got nothing
vol.xml:8: element physical: Relax-NG validity error : Invalid sequence in interleave
vol.xml:1: element volume: Relax-NG validity error : Element volume failed to validate content
vol.xml fails to validate

Actual results:
virt-xml-validate fails for capabilities and storagevol

Expected results:
virt-xml-validate works well for capabilities and storagevol

Additional info:

Comment 2 John Ferlan 2018-05-19 12:19:29 UTC
Posted patches upstream to resolve the grammar issues:

https://www.redhat.com/archives/libvir-list/2018-May/msg01455.html

For storagevol in particular, see patch 1. For capability see patches 2-7 (some RHEL related, some not).

Comment 3 John Ferlan 2018-05-25 14:42:36 UTC
Patches pushed... There are multiple patches for this particular one as more grammar errors were pointed out once fixing the microcode, which is:

commit 39d76c68569fa4a1816172e0d971a6b148ba5c23
Author: John Ferlan <jferlan>
Date:   Fri May 18 17:25:01 2018 -0400

    schema: Add physical sizing element for storagevol grammar
    
...
    
    Commit id '78661cb' added a physical output, but failed to update
    the schema resulting in a failure from virt-xml-validate.
    
    While at it - update the storagevolschemadata for the output.
...

$ git describe 39d76c68569fa4a1816172e0d971a6b148ba5c23
v4.3.0-315-g39d76c6856
$

After that was fixed, then the valid values for <uri_transports> required some updates resulting in:

commit 4cfa9309dc16ef58fd4174e886c5fdcf97f5f4e6
Author: John Ferlan <jferlan>
Date:   Fri May 18 18:00:23 2018 -0400

    schema: Add rdma for host migrate transport capability
    
...
    
    Commit id 'b3fd95e36' added rdma as a valid option for
    virCapabilitiesAddHostMigrateTransport, but didn't update
    the capabilities schema resulting in possible virt-xml-validate
    failure.
    
    While at it, update the capabilityschemadata for caps-qemu-kvm
...

$ git describe 4cfa9309dc16ef58fd4174e886c5fdcf97f5f4e6
v4.3.0-318-g4cfa9309dc
$

Finally, it was determined the <pages> element differs slightly in its two usages leading to:

commit c1a0601debfe2c84160234cf6269606f4198faa0
Author: John Ferlan <jferlan>
Date:   Sat May 19 07:02:47 2018 -0400

    schema: Fix capability grammar for pagesElem
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1572491
    
    Commit id '02129b7c0' added a single pagesElem for slightly
    different purposes. One usage was an output for host page size
    listing and the other for NUMA supported page sizes. For the
    former, only the pages unit and size are formatted, while for
    the latter the pages unit, size, and availability data is formatted.
    
    The virt-xml-validate would fail because it expected something
    extra in the host page size output. So split up pagesElem a bit
    and create pagesHost and pagesNuma for the differences.
    
    Modify some capabilityschemadata output to have the output - even
    though the results may not be realistic with respect to the
    original incarnation of the data.

...

$ git describe c1a0601debfe2c84160234cf6269606f4198faa0
v4.3.0-321-gc1a0601deb
$

Comment 5 yafu 2018-06-29 03:25:17 UTC
Verified with libvirt-4.4.0-2.el7.x86_64.

Test steps are the same as comment0.

Comment 7 errata-xmlrpc 2018-10-30 09:55:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3113