Changelog:
V2 -
- patch 1 (new patch, split from v1 patch 1):
- fix result string to enum mapping; move into monitor layer
- update unit test for all four result strings
- report unknown result strings as errors
- patch 2:
- squash v1 patch 2 (propagate responsibleProps through monitor layer) into this patch
- drop GenericError interception block
- fix virReportError overwriting error from virJSONValueArrayToStringList
- update qemu_driver.c caller to pass NULL
- patch 3 (split from v1 patch 1):
- add block scopes per subtest
- use STRNEQ_NULLABLE
- drop "superset + type" test case
- fix bullet list to only include cases added by this patch
- patch 4:
- replace qemuCPUModelCompatResult enum with virCPUCompareResult
- move "type" property filtering into qemuProcessCheckS390CPU()
- wire check into qemuProcessUpdateGuestCPU() instead of qemu_migration.c
- simplify qemuConnectCPUModelComparison() to delegate to new helper
- report unknown results as errors
-------------------
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: refactor GetCPUModelComparison to return virCPUCompareResult
qemu: extend GetCPUModelComparison to return responsible-properties
tests: extend qemuMonitorJSONGetCPUModelComparison test coverage
qemu: introduce qemuProcessCheckS390CPU helper
src/qemu/qemu_driver.c | 27 +-----
src/qemu/qemu_monitor.c | 11 +--
src/qemu/qemu_monitor.h | 4 +-
src/qemu/qemu_monitor_json.c | 45 +++++++---
src/qemu/qemu_monitor_json.h | 4 +-
src/qemu/qemu_process.c | 75 ++++++++++++++++
src/qemu/qemu_process.h | 9 ++
tests/qemumonitorjsontest.c | 167 ++++++++++++++++++++++++++++++++---
8 files changed, 284 insertions(+), 58 deletions(-)
--
2.48.1