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