On 10/2/26 04:36, Rorie Reyes wrote:
The qemu-cpu-model-comparison QMP command can return a
"responsible-properties" array identifying which CPU properties
caused an incompatibility result.  Expose this through the JSON
monitor layer by adding an optional `responsibleProps` output
parameter (char ***) to qemuMonitorJSONGetCPUModelComparison().

When the caller passes a non-NULL pointer the array is populated
from the QMP response; passing NULL preserves the existing
behaviour so all current callers are unaffected until they opt in.

The existing caller in qemu_monitor.c is updated to pass NULL so
the build continues to work.

A GenericError response from the QMP command is intercepted and
re-reported as VIR_ERR_CPU_INCOMPATIBLE with the QEMU error
description. Assuming the JSON query was properly constructed, all
GenericErrors should indicate an incompatible CPU model due to QEMU
binary limitations (e.g. old binary does not recognize newer
features or models).

The existing unit test is updated to pass the new argument and
extended with additional calls: one that verifies the
responsible-properties array is correctly populated from the QMP
response, one that verifies it is NULL when the key is absent from
the response, one that verifies it is NULL when the array is empty,
and cases for "identical", "subset", and "superset" results
(including a "type" responsible-property) to cover all
result-string mappings.

Signed-off-by: Rorie Reyes<[email protected]>
---
  src/qemu/qemu_monitor.c      |   2 +-
  src/qemu/qemu_monitor_json.c |  26 +++++-
  src/qemu/qemu_monitor_json.h |   5 +-
  tests/qemumonitorjsontest.c  | 159 +++++++++++++++++++++++++++++++++--
  4 files changed, 182 insertions(+), 10 deletions(-)

Reviewed-by: Boris Fiuczynski <[email protected]>


--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Ehningen
Registergericht: Amtsgericht Stuttgart, HRB 243294

Reply via email to