On Thu, Apr 23, 2026 at 17:27:26 +0530, Akash Kulhalli via Devel wrote:
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.
Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com> --- src/qemu/qemu_hotplug.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index b7a282b96e52..7828b7d73821 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6728,6 +6728,7 @@ qemuDomainRemoveVcpu(virDomainObj *vm, unsigned int nvcpus = vcpupriv->vcpus;
As noted in 1/5, a VCPu object in qemu can map to multiple vcpus that are represented in the libvirt XML. If you keep the design of the event as is, you'll thus need to emit the event for all vcpus which were disabled in the libvirt XML.
size_t i; ssize_t offlineVcpuWithTid = -1; + virObjectEvent *event = NULL;
if (qemuDomainRefreshVcpuInfo(vm, VIR_ASYNC_JOB_NONE, false) < 0) return -1; @@ -6757,6 +6758,10 @@ qemuDomainRemoveVcpu(virDomainObj *vm,
virDomainAuditVcpu(vm, oldvcpus, oldvcpus - nvcpus, "update", true);
+ /* fire the libvirt `vcpu-removed` event */ + event = virDomainEventVcpuRemovedNewFromObj(vm, vcpu); + virObjectEventStateQueue(priv->driver->domainEventState, event);
This function has a convenient loop going through all the vcpus which will be marked as disabled after this so you'll need to emit this even there.
+ return 0; }
-- 2.47.3