On 11/1/21 1:27 AM, Daniel Henrique Barboza wrote:
Hi,
This small series adds support to a new QMP event called
DEVICE_UNPLUG_GUEST_SUPPORT introduced recently in upstream QEMU.
This event is emitted when a device removal error is detected in the guest
side. Libvirt can use this event to to abort the removal operation
immediately instead of waiting for the operation to timeout.
Upstream QEMU is emitting this event in the following cases:
- memory removal errors in ACPI and pseries guests
- CPU removal errors in pseries guests
Adding support to DEVICE_UNPLUG_GUEST_ERROR will allow Libvirt to
detect all device removal errors that QEMU might add in the future.
The patches were tested using a common scenario where CPU removal will
fail everytime in a pseries guest:
- start a pseries guest with 1 CPU
- add one CPU
- offline vcpu0 in the guest kernel
- try to remove the recently added CPU (vcpu1). The kernel will refuse the
unplug because vcpu1 is the last online CPU
This test case will cause 'setvcpus' to hang until the timeout is fired:
[danielhb@ltc-boston118 build]$ sudo ./run tools/virsh setvcpus f34 1
error: Timed out during operation: vcpu unplug request timed out. Unplug result must be
manually inspected in the domain
With this series applied, 'setvcpus' will report the error as soon as
the DEVICE_UNPLUG_GUEST_ERROR event is received:
[danielhb@ltc-boston118 build]$ sudo ./run tools/virsh setvcpus f34 1
error: operation failed: unplug of device was rejected by the guest
I haven't add any documentation because I didn't find a good place to
document this change, and I'm not sure if this is necessary either since
this doesn't change user ABI. If this requires a doc change please let
me know.
Right, this is an internal implementation and your patches just emit an
already existing event, so I think no additional doc is needed. Except
maybe a NEWS.rst?
Daniel Henrique Barboza (2):
tests: update QEMU and domain ppc64 capabilities for qemu 6.2
qemu: add DEVICE_UNPLUG_GUEST_ERROR event support
src/qemu/qemu_monitor.c | 12 +
src/qemu/qemu_monitor.h | 9 +
src/qemu/qemu_monitor_json.c | 19 +
src/qemu/qemu_process.c | 37 +
tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 138 +
.../caps_6.2.0.ppc64.replies | 31062 ++++++++++++++++
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1167 +
...default-video-type-ppc64.ppc64-latest.args | 13 +-
...ault-cpu-kvm-pseries-2.7.ppc64-latest.args | 13 +-
...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 13 +-
...ault-cpu-kvm-pseries-4.2.ppc64-latest.args | 13 +-
...ault-cpu-tcg-pseries-2.7.ppc64-latest.args | 13 +-
...ault-cpu-tcg-pseries-3.1.ppc64-latest.args | 13 +-
...ault-cpu-tcg-pseries-4.2.ppc64-latest.args | 13 +-
.../ppc64-pseries-graphics.ppc64-latest.args | 29 +-
.../ppc64-pseries-headless.ppc64-latest.args | 23 +-
.../ppc64-tpmproxy-single.ppc64-latest.args | 11 +-
.../ppc64-tpmproxy-with-tpm.ppc64-latest.args | 13 +-
.../tpm-emulator-spapr.ppc64-latest.args | 19 +-
19 files changed, 32531 insertions(+), 99 deletions(-)
create mode 100644 tests/domaincapsdata/qemu_6.2.0.ppc64.xml
create mode 100644 tests/qemucapabilitiesdata/caps_6.2.0.ppc64.replies
create mode 100644 tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal