We currently ignore unknown elements in the CPU XML description, e.g. with virsh cpu-compare and hypervisor-cpu-compare. This makes '<cpu><faeture name="..."/></cpu>' (note the typo in "faeture") semantically identic to '<cpu/>'. No error is reported. This series adds checks for unrecognized attributes and elements in the "<cpu>" element, catching this kind of mistake. V1: https://www.redhat.com/archives/libvir-list/2020-September/msg00933.html V2: https://www.redhat.com/archives/libvir-list/2020-September/msg01073.html Changed: * Added more detailed commit messages * Added missing man page details * Split the changes slightly differently in the commits * CPU tests now always validate XML documents * Fixed typo "nonexistant" -> "nonexistent" Tim Wiederhake (8): schema: Unify apostrophe and quotation mark usage schema: Move host cpu definition to cputypes.rng schema: Move guest cpu definition to cputypes.rng schema: Add schema for guest or host cpu definition util: Allow validation for single XML node cpu: Wire in XML validation virsh: Add "validate" argument to [hypervisor-]cpu-compare tests: Add tests for unknown elements and attributes in cpu defintion docs/manpages/virsh.rst | 9 +- docs/schemas/basictypes.rng | 82 +-- docs/schemas/capability.rng | 466 ++++++--------- docs/schemas/cpu.rng | 12 + docs/schemas/cputypes.rng | 117 +++- docs/schemas/domain.rng | 10 +- docs/schemas/domainbackup.rng | 178 +++--- docs/schemas/domaincaps.rng | 236 ++++---- docs/schemas/domaincheckpoint.rng | 62 +- docs/schemas/domaincommon.rng | 431 +++++++------- docs/schemas/domainsnapshot.rng | 104 ++-- docs/schemas/interface.rng | 6 +- docs/schemas/meson.build | 1 + docs/schemas/network.rng | 44 +- docs/schemas/networkcommon.rng | 26 +- docs/schemas/networkport.rng | 6 +- docs/schemas/nodedev.rng | 464 +++++++-------- docs/schemas/nwfilter.rng | 32 +- docs/schemas/nwfilterbinding.rng | 4 +- docs/schemas/secret.rng | 70 +-- docs/schemas/storagecommon.rng | 110 ++-- docs/schemas/storagepool.rng | 584 +++++++++---------- docs/schemas/storagepoolcaps.rng | 64 +- docs/schemas/storagevol.rng | 150 ++--- include/libvirt/libvirt-host.h | 2 + src/bhyve/bhyve_driver.c | 7 +- src/conf/cpu_conf.c | 25 +- src/conf/cpu_conf.h | 6 +- src/conf/domain_conf.c | 3 +- src/cpu/cpu.c | 5 +- src/cpu/cpu.h | 3 +- src/libxl/libxl_driver.c | 7 +- src/qemu/qemu_domain.c | 5 +- src/qemu/qemu_driver.c | 18 +- src/qemu/qemu_migration_cookie.c | 3 +- src/util/virxml.c | 15 + src/util/virxml.h | 6 + tests/cputest.c | 28 +- tests/cputestdata/x86_64-bogus-attribute.xml | 2 + tests/cputestdata/x86_64-bogus-element.xml | 3 + tools/virsh-host.c | 14 + 41 files changed, 1762 insertions(+), 1658 deletions(-) create mode 100644 docs/schemas/cpu.rng create mode 100644 tests/cputestdata/x86_64-bogus-attribute.xml create mode 100644 tests/cputestdata/x86_64-bogus-element.xml -- 2.26.2