From: Akash Kulhalli via Devel Date: Wed, 29 Apr 2026 12:13:26 +0000 (+0530) Subject: qemu: emit vcpu-removed event on unplug completion X-Git-Tag: v12.4.0-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03d339dc03dbf63dbe73f7e8197508ed80617cc2;p=thirdparty%2Flibvirt.git qemu: emit vcpu-removed event on unplug completion Emit the vcpu-removed event when QEMU vCPU unplug completes. Hook this into qemuDomainRemoveVcpu(), which covers both the synchronous completion path and the DEVICE_DELETED-driven alias removal path. Some architectures may have multiple vcpus grouped under a single qemu vcpu object; on those platforms a `vcpu-removed` event will be emitted for each vcpu that is removed from this group. Signed-off-by: Akash Kulhalli Reviewed-by: Peter Krempa --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 71a64b0879..31086b4b89 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6727,6 +6727,7 @@ qemuDomainRemoveVcpu(virDomainObj *vm, unsigned int nvcpus = vcpupriv->vcpus; size_t i; ssize_t offlineVcpuWithTid = -1; + virObjectEvent *event = NULL; if (qemuDomainRefreshVcpuInfo(vm, VIR_ASYNC_JOB_NONE, false) < 0) return -1; @@ -6744,6 +6745,10 @@ qemuDomainRemoveVcpu(virDomainObj *vm, if (offlineVcpuWithTid == -1) offlineVcpuWithTid = i; } + + /* fire the `vcpu-removed` event for each removed vcpu */ + event = virDomainEventVcpuRemovedNewFromObj(vm, i); + virObjectEventStateQueue(priv->driver->domainEventState, event); } if (offlineVcpuWithTid != -1) {