[libvirt PATCH 0/2] Schema fixes for virsh [hypervisor-]cpu-compare

See individual commit messages for more details. Tim Wiederhake (2): schemas: Deduplicate cpuTopology in cputypes.rng schema: Allow counter element in host cpu definition docs/schemas/cputypes.rng | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.26.2

The duplicate had the "dies" attribute missing, causing $ virsh capabilities > cap.xml $ virsh [hypervisor-]cpu-compare cap.xml --validate to fail with error: Failed to compare hypervisor CPU with cap.xml error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/cpu.rng Invalid attribute dies for element topology Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cputypes.rng | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng index aea6ff0267..c4e7621659 100644 --- a/docs/schemas/cputypes.rng +++ b/docs/schemas/cputypes.rng @@ -337,17 +337,7 @@ </element> </optional> <optional> - <element name="topology"> - <attribute name="sockets"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="cores"> - <ref name="positiveInteger"/> - </attribute> - <attribute name="threads"> - <ref name="positiveInteger"/> - </attribute> - </element> + <ref name="cpuTopology"/> </optional> <zeroOrMore> <element name="feature"> -- 2.26.2

If the capabilities include a counter element, e.g. <counter name='tsc' frequency='2591999000' scaling='no'/> the XML could not be validated: $ virsh capabilities > cap.xml $ virsh [hypervisor-]cpu-compare cap.xml --validate error: Failed to compare hypervisor CPU with cap.txt error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/cpu.rng Did not expect element counter there Signed-off-by: Tim Wiederhake <twiederh@redhat.com> --- docs/schemas/cputypes.rng | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng index c4e7621659..f66bc62ba7 100644 --- a/docs/schemas/cputypes.rng +++ b/docs/schemas/cputypes.rng @@ -336,6 +336,19 @@ </attribute> </element> </optional> + <optional> + <element name="counter"> + <attribute name="name"> + <text/> + </attribute> + <attribute name="frequency"> + <ref name="positiveInteger"/> + </attribute> + <attribute name="scaling"> + <ref name="virYesNo"/> + </attribute> + </element> + </optional> <optional> <ref name="cpuTopology"/> </optional> -- 2.26.2

On 12/15/20 1:16 PM, Tim Wiederhake wrote:
See individual commit messages for more details.
Tim Wiederhake (2): schemas: Deduplicate cpuTopology in cputypes.rng schema: Allow counter element in host cpu definition
docs/schemas/cputypes.rng | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal
participants (2)
-
Michal Prívozník
-
Tim Wiederhake