Bug 1572491 - virt-xml-validate validate fails for capabilities and storagevol
Summary: virt-xml-validate validate fails for capabilities and storagevol
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: yafu
Depends On:
TreeView+ depends on / blocked
Reported: 2018-04-27 07:06 UTC by yafu
Modified: 2018-10-30 09:57 UTC (History)
4 users (show)

Fixed In Version: libvirt-4.4.0-1.el7
Doc Type: No Doc Update
Doc Text:
Clone Of:
Last Closed: 2018-10-30 09:55:31 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:57:51 UTC

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):

How reproducible:

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:


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

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
    While at it, update the capabilityschemadata for caps-qemu-kvm

$ git describe 4cfa9309dc16ef58fd4174e886c5fdcf97f5f4e6

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
    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

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.


Note You need to log in before you can comment on or make changes to this bug.