This series extends the qemu-cpu-model-comparison QMP interface in
libvirt to surface the "responsible-properties" array returned by QEMU,
and uses that information to perform a pre-flight CPU compatibility check
on s390x before an incoming migration is accepted.

Background
----------
On x86, QEMU rejects an incompatible CPU model at domain start time and
produces a meaningful error.  On s390x the guest starts successfully but
may fail later in an opaque way if the destination host lacks required
CPU features.  This series brings s390x in line with x86 by catching the
incompatibility early, aborting the migration cleanly, and reporting
exactly which CPU properties are responsible.

Functional Test Instructions
-----------------------------
Prerequisites:
  - Two s390x hosts (source and destination) with different CPU feature
    levels from the same generation lineage (e.g. z16 and z17).
  - libvirt and QEMU built from this series on both hosts.
  - QEMU must support the query-cpu-model-comparison QMP command
    (QEMU >= 5.1).

Test case 1 — Incompatible CPU model is rejected cleanly:
  1. Define a guest on the source host using a custom s390x CPU model
     that includes features not present on the destination host.
  2. Initiate a live migration to the destination host:

       virsh migrate --live <domain> qemu+ssh://dest-host/system

  3. Expected result: migration fails immediately with a clear libvirt
     error before QEMU starts on the destination, e.g.:

       error: operation failed: guest CPU model is a newer generation
       than the destination host CPU model

     or, for a feature-level mismatch within the same generation:

       error: operation failed: destination host CPU model is missing
       features required by the guest CPU model: <prop1>, <prop2>

  4. Verify the guest is still running cleanly on the source host:

       virsh domstate <domain>   # should report: running

Test case 2 — Compatible CPU model migrates successfully:
  1. Define a guest using a CPU model fully supported by the destination
     (e.g. gen16a-base guest migrating to a gen17 host).
  2. Initiate the same live migration.
  3. Expected result: migration completes successfully with no errors.

Rorie Reyes (4):
  qemu: extend GetCPUModelComparison to return responsible-properties
  qemu: propagate responsibleProps parameter through monitor layer
  qemu: introduce qemuProcessCPUModelComparison helper
  qemu: check CPU model compatibility on s390x before incoming migration

 src/qemu/qemu_driver.c       |  20 ++---
 src/qemu/qemu_migration.c    | 114 +++++++++++++++++++++++++
 src/qemu/qemu_monitor.c      |   8 +-
 src/qemu/qemu_monitor.h      |   3 +-
 src/qemu/qemu_monitor_json.c |  26 +++++-
 src/qemu/qemu_monitor_json.h |   5 +-
 src/qemu/qemu_process.c      |  50 +++++++++++
 src/qemu/qemu_process.h      |  21 +++++
 tests/qemumonitorjsontest.c  | 159 +++++++++++++++++++++++++++++++++--
 9 files changed, 381 insertions(+), 25 deletions(-)

-- 
2.48.1

Reply via email to