[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt PATCH 0/9] Make unknown XML elements fail CPU comparison



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=3D"..."/></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

Changed:
* Factored out Schema defintion of different cpu elements
* Performing validation against actual schema
* Add "--validate" option to virsh [hypervisor-]cpu-compare to opt-in to vali=
dation
* Drive-by: Unify quotation style in docs/schemas/*

Tim Wiederhake (9):
  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: Validate XML
  virsh: Add "validate" argument to [hypervisor-]cpu-compare
  tests: cpu: Allow passing flags to cpuTestLoadXML
  tests: Add tests for unknown elements and attributes in cpu defintion

 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               |   1 +
 src/bhyve/bhyve_driver.c                     |   7 +-
 src/conf/cpu_conf.c                          |  28 +-
 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                              |  52 +-
 tests/cputestdata/x86_64-bogus-attribute.xml |   2 +
 tests/cputestdata/x86_64-bogus-element.xml   |   3 +
 tools/virsh-host.c                           |  14 +
 40 files changed, 1773 insertions(+), 1664 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

--=20
2.26.2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]