From nobody Sun Feb 8 18:44:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1670935256; cv=none; d=zohomail.com; s=zohoarc; b=JNwK7uyL1LMT46++oVL91MfJ2Xx8r8N5AC2er0VGFiKNlcgpTHcPrxXXp/Tw0VpafRwYYJdBdi0LsfKTPTiKaudGPKIACFpBrvjpUieopZlBXUCgalR9oUSw3V8pWldToURH/U7k9J5LfWogbi49zvkzS4hLCCgMMgMEx9mhDmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670935256; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Io3scaFSWiJ1uqQEkpocn17eFXKtFIjoEN1UOvX8ke0=; b=iNA7/03SzJaAqVlIoxJJMUjul+luTuBJc3cIYUtm6CzhHr6pGKwcVJwVzpxE1Z7RqXAUuhbCHXarbPjTwYW0y+dCZGdn+wXrWy3GGS0xNMbY4EP7DiGjUR5hqZjo58esC0HPdMnNeXvRutcVOKVc9dRiOlvGE/29G6aLFMLveXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1670935256406785.0175008640156; Tue, 13 Dec 2022 04:40:56 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-314-IhuS136EM3C4wNuhu6ohJw-1; Tue, 13 Dec 2022 07:40:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26B191C07595; Tue, 13 Dec 2022 12:40:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94B5D53AA; Tue, 13 Dec 2022 12:40:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CFF2D1946588; Tue, 13 Dec 2022 12:40:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 46FD61946586 for ; Tue, 13 Dec 2022 12:40:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1A17B2166B29; Tue, 13 Dec 2022 12:40:40 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2AAD2166B26 for ; Tue, 13 Dec 2022 12:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670935255; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Io3scaFSWiJ1uqQEkpocn17eFXKtFIjoEN1UOvX8ke0=; b=QbH/ZocxwqVSh5q3/27XfzZFXCLBKZr+Wd2hW/r9kOnIoSEfBfkA4/PWEz6+VREZVobbNV rP1xqIJZU33btuZiJ1n/kViQmMDXymGLgFOT7nmnitX+gK0f9Ua71GPq7G4u4SYyrBkcqL GHYZnWzpWH2FbT51TRfaLF5warcTpfU= X-MC-Unique: IhuS136EM3C4wNuhu6ohJw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH] qemu_process: add tray changed event to queue in refresh disks Date: Tue, 13 Dec 2022 13:40:26 +0100 Message-Id: <7c2fee3b9ea73ed47b512fd994f84a58cce447bd.1670935222.git.khanicov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1670935258413100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There are some cases when the internal state of disks can change without qemu sending events about it (e.g. a disk can close during reset). In case this happens, we should emit an event about the modified disk. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1824722#c20 Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5de55435d2..601e9694b6 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8675,6 +8675,7 @@ qemuProcessRefreshDisks(virDomainObj *vm, qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(GHashTable) table =3D NULL; size_t i; + virQEMUDriver *driver =3D QEMU_DOMAIN_PRIVATE(vm)->driver; =20 if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) =3D=3D 0) { table =3D qemuMonitorGetBlockInfo(priv->mon); @@ -8697,14 +8698,26 @@ qemuProcessRefreshDisks(virDomainObj *vm, continue; =20 if (info->removable) { + virObjectEvent *event =3D NULL; + int reason; + if (info->empty) virDomainDiskEmptySource(disk); =20 if (info->tray) { - if (info->tray_open) + if (info->tray_open =3D=3D disk->tray_status) + continue; + + if (info->tray_open) { + reason =3D VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN; disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_OPEN; - else + } else { + reason =3D VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE; disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_CLOSED; + } + + event =3D virDomainEventTrayChangeNewFromObj(vm, disk->inf= o.alias, reason); + virObjectEventStateQueue(driver->domainEventState, event); } } =20 --=20 2.38.1