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

Tim Wiederhake posted 5 patches 3 years, 6 months ago
Test syntax-check failed
Failed in applying to current master (apply log)
tests/virschematest.c                         |  1 +
tools/virsh-host.c                            | 14 ++++++
22 files changed, 153 insertions(+), 43 deletions(-)
create mode 100644 docs/schemas/cpu_test.rng
[libvirt PATCH v4 0/5] Make unknown XML elements fail CPU comparison
Posted by Tim Wiederhake 3 years, 6 months ago
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
V2: https://www.redhat.com/archives/libvir-list/2020-September/msg01073.html
V3: https://www.redhat.com/archives/libvir-list/2020-September/msg01555.html

Changed:
* Some patches from V3 are merged
* Changes to commit messages
* Perform testing by means of virschematest

Tim Wiederhake (5):
  schema: Make element "topology" in host CPU definition optional
  cpu: Wire in XML validation
  tests: Rename some test files in cputestdata
  tests: Enable CPU XML validation in the tests.
  virsh: Add "validate" argument to [hypervisor-]cpu-compare

 docs/manpages/virsh.rst                       |  9 ++--
 docs/schemas/cpu_test.rng                     | 48 +++++++++++++++++++
 docs/schemas/cputypes.rng                     | 24 +++++-----
 docs/schemas/meson.build                      |  1 +
 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 +-
 tests/cputest.c                               | 15 +++---
 ...invalid.xml =3D> ppc64-guest-compat-bad.xml} |  0
 ...invalid.xml =3D> ppc64-guest-legacy-bad.xml} |  0
 ...id.xml =3D> ppc64-host+guest-compat-bad.xml} |  0
 ...id.xml =3D> ppc64-host+guest-legacy-bad.xml} |  0
 tests/virschematest.c                         |  1 +
 tools/virsh-host.c                            | 14 ++++++
 22 files changed, 153 insertions(+), 43 deletions(-)
 create mode 100644 docs/schemas/cpu_test.rng
 rename tests/cputestdata/{ppc64-guest-compat-invalid.xml =3D> ppc64-guest-co=
mpat-bad.xml} (100%)
 rename tests/cputestdata/{ppc64-guest-legacy-invalid.xml =3D> ppc64-guest-le=
gacy-bad.xml} (100%)
 rename tests/cputestdata/{ppc64-host+guest-compat-invalid.xml =3D> ppc64-hos=
t+guest-compat-bad.xml} (100%)
 rename tests/cputestdata/{ppc64-host+guest-legacy-invalid.xml =3D> ppc64-hos=
t+guest-legacy-bad.xml} (100%)

--=20
2.26.2


Re: [libvirt PATCH v4 0/5] Make unknown XML elements fail CPU comparison
Posted by Peter Krempa 3 years, 6 months ago
On Wed, Oct 07, 2020 at 10:54:53 +0200, Tim Wiederhake wrote:
> 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
> V2: https://www.redhat.com/archives/libvir-list/2020-September/msg01073.html
> V3: https://www.redhat.com/archives/libvir-list/2020-September/msg01555.html
> 
> Changed:
> * Some patches from V3 are merged
> * Changes to commit messages
> * Perform testing by means of virschematest
> 
> Tim Wiederhake (5):
>   schema: Make element "topology" in host CPU definition optional
>   cpu: Wire in XML validation
>   tests: Rename some test files in cputestdata
>   tests: Enable CPU XML validation in the tests.
>   virsh: Add "validate" argument to [hypervisor-]cpu-compare

Patches 2, 3, and 5 are pushed now.