From nobody Sun Apr 28 20:35:42 2024 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=1675932654; cv=none; d=zohomail.com; s=zohoarc; b=Oa/cIZY+3oVDIWFu5ZspvBtr/BrxfYp2rN8tDYI0DWa4ReoyzR/ngYcOwNMcmKfHg5VDWDsL/xT7GQmAle4rTK8Iea2a2hwHOmgSi/MOr6u6xYkkZ0hgJ3lUpXcUbYzVUw1yd3DnBWWspZ/W866rwXhDzx9Dk+59Lfv15TUCR6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675932654; 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=jhdJw4Cy0e3MmN5TWFcxkqsY/jJfrSNsJtKXI8v6U10=; b=NsJzI+R8kyxK/cUS/aj/hv5pgW14Nr1WuO92E65a0jbIUhfKqrtQT380i25WPVdNzrYKiRamT6yvI6TZgs5CEnQRIDx7GjUI0FUIeR2+uW1znuwDNyS585MeqEpCEbM81t1af0nk5Syql3bL2PHqgB4jWTbOA+LaYtTYyFT2E6Q= 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 1675932654916243.59508125449202; Thu, 9 Feb 2023 00:50:54 -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-68-P9mzbB-oNnaEv69MpFU3FQ-1; Thu, 09 Feb 2023 03:50:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AECA329ABA12; Thu, 9 Feb 2023 08:50:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B8822026D68; Thu, 9 Feb 2023 08:50:50 +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 4617C194658D; Thu, 9 Feb 2023 08:50:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D68991946589 for ; Thu, 9 Feb 2023 08:50:43 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F368D492B00; Thu, 9 Feb 2023 08:50:42 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-29.brq.redhat.com [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53416492C3E for ; Thu, 9 Feb 2023 08:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675932653; 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=jhdJw4Cy0e3MmN5TWFcxkqsY/jJfrSNsJtKXI8v6U10=; b=daCAjOirtUXAbdypvp4MFC7gSilBdNtyNxV2J3qhYFAx96MIg2j7loZghJ6qkt//rlPI99 2/4ibGG6vGdX9qklKQEQoMQa3YU6BsJ8InadLF/Xc2jWbQCsTa+UuQUfrFKnae1mhgmrAJ TpQA+LG5SwFc33CFvdcSQGufRRbMlvU= X-MC-Unique: P9mzbB-oNnaEv69MpFU3FQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemuProcessRefreshDisks: Don't skip filling of disk information if tray state didn't change Date: Thu, 9 Feb 2023 09:50:35 +0100 Message-Id: <963dcc1272fb19a2b87d1e07d9066073c9196543.1675932635.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.4 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: 1675932657085100001 Content-Type: text/plain; charset="utf-8" Commit 5ef2582646eb98 added emitting of even when refreshign disk state, where it wanted to avoid sending the event if disk state didn't change. This was achieved by using 'continue' in the loop filling the information. Unfortunately this skips extraction of whether the device has a tray which is propagated into internal structures, which in turn broke cdrom media change as the code thought there's no tray for the device. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2166411 Fixes: 5ef2582646eb98af208ce37355f82bdef39931fa Signed-off-by: Peter Krempa Reviewed-by: Kristina Hanicova --- src/qemu/qemu_process.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e96b7689a3..59aa3f02aa 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8711,16 +8711,13 @@ qemuProcessRefreshDisks(virDomainObj *vm, continue; if (info->removable) { - virObjectEvent *event =3D NULL; + bool emitEvent =3D info->tray_open !=3D disk->tray_status; int reason; if (info->empty) virDomainDiskEmptySource(disk); if (info->tray) { - 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; @@ -8729,8 +8726,10 @@ qemuProcessRefreshDisks(virDomainObj *vm, disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_CLOSED; } - event =3D virDomainEventTrayChangeNewFromObj(vm, disk->inf= o.alias, reason); - virObjectEventStateQueue(driver->domainEventState, event); + if (emitEvent) { + virObjectEvent *event =3D virDomainEventTrayChangeNewF= romObj(vm, disk->info.alias, reason); + virObjectEventStateQueue(driver->domainEventState, eve= nt); + } } } --=20 2.39.1