[libvirt PATCH 0/3] cpu: Make unknown XML elements fail CPU comparison

Tim Wiederhake twiederh at redhat.com
Wed Sep 16 13:33:53 UTC 2020


We currently ignore unknown elements in the CPU XML description, e.g. with vi=
rsh
cpu-compare and hypervisor-cpu-compare. This makes '<cpu><faeture name=3D"...=
"/></cpu>'
(note the typo in "faeture") semantically identic to '<cpu/>'. No error is re=
ported.

This series adds checks for unrecognized attributes and elements in the "<cpu=
>" element,
catching this kind of mistake.

An alternative approach to this problem would be to create a new schema, whic=
h might
turn out awkward as cpu-compare and hypervisor-cpu-compare accept a wide rang=
e of
cpu descriptions, including full domain, capabilities, and domainCapabilities=
 XML.

Tim Wiederhake (3):
  tests: Allow cpuTestLoadXML to fail for the guest if we expect it the
    test to fail
  tests: Ensure that cpu comparison fails in the presence of unknown xml
    elements
  cpu: Fail CPU comparison in the presence of unknown elements.

 src/conf/cpu_conf.c                          | 38 ++++++++++++++++++++
 tests/cputest.c                              | 15 +++++---
 tests/cputestdata/x86_64-bogus-attribute.xml |  2 ++
 tests/cputestdata/x86_64-bogus-element.xml   |  3 ++
 4 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml
 create mode 100644 tests/cputestdata/x86_64-bogus-element.xml

--=20
2.26.2





More information about the libvir-list mailing list