From nobody Mon Feb 9 01:21:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770304287; cv=none; d=zohomail.com; s=zohoarc; b=JEIKFzBmlO4AINM+JA7wJKxxj7b0q5EckQaLo6MvezpykeBEYoeZOPcSgPOrffllTQ9bekstQBZbh8OfG2e0XB3yIdUB4HnS5cNerU/MeIeth5+bu0GvCs2KsARHB3YFzFIVUrx0CTjVmVfAks/KoGDWkbmiwkuxnw6ldFw4y8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770304287; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=ohxlIauYljD71FOumNWdF+2CzTF3kMWMwFgFaoQ4QP4=; b=gx6tahRvLTirduvV9wZa749U1tj5dsV1SnmPkzwDIqU1N7VQG8jwd4zds3ULRdp26H/oiA3jrIrjWCjAhrW7d62O6kM5PtEX+D+JV877awt9kPkyj7vapyEhiLLnyLO/zLHonXkjhiZpa+bRdhc6FmyLkb5UwNSOpppR2ZwW66I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770304287604628.9592413280452; Thu, 5 Feb 2026 07:11:27 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 04D9641E59; Thu, 5 Feb 2026 10:11:27 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id C5AD044187; Thu, 5 Feb 2026 09:59:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 999C541C5F; Thu, 5 Feb 2026 09:59:41 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BE29E41B30 for ; Thu, 5 Feb 2026 09:55:53 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-_TDC1zkHM-u3psIfNPUEVw-1; Thu, 05 Feb 2026 09:55:52 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 52B6319560B0 for ; Thu, 5 Feb 2026 14:55:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9C5D71800464 for ; Thu, 5 Feb 2026 14:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770303353; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=ohxlIauYljD71FOumNWdF+2CzTF3kMWMwFgFaoQ4QP4=; b=YxT96hjPKw4XgDSgjETvw/XQR3Kezm96B+MYQEyfJKwuC87sUBCE1/5kigqQQXLqqtzN6p xZlTwyzNXkWJNcbx5GFoFW/uRk8fO8T1H4G1zdzOuxD+EhiQ/bzUuVMsNIxBsifFkyRnz5 +jb+/RWnXg44LuyGfSwmEdQ2xJKDH4w= X-MC-Unique: _TDC1zkHM-u3psIfNPUEVw-1 X-Mimecast-MFC-AGG-ID: _TDC1zkHM-u3psIfNPUEVw_1770303351 To: devel@lists.libvirt.org Subject: [PATCH 18/20] qemuProcessRefreshDisks: Don't bother to refresh disks on cold boot Date: Thu, 5 Feb 2026 15:55:26 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Qj3JbiaJB8ThIRHmlkTJW5pWiHzLOdVnuONddU2KItQ_1770303351 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OXPCR7UIRX3CA65YFX67IDUBE7EC5BGQ X-Message-ID-Hash: OXPCR7UIRX3CA65YFX67IDUBE7EC5BGQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770304289820154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The only thing that 'qemuProcessRefreshDisks' currently does is to update tray state for disks. This makes no sense on cold boot since only cdroms have tray and the tray is closed. Avoid the extra call to 'query-block' on cold boot and just assume CDROM has a closed tray. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 47 ++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2628a89cbf..51b91f2b98 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8640,6 +8640,7 @@ qemuProcessRefreshRxFilters(virDomainObj *vm, static int qemuProcessRefreshDisks(virDomainObj *vm, + bool cold_start, virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -8647,13 +8648,15 @@ qemuProcessRefreshDisks(virDomainObj *vm, g_autoptr(GHashTable) table =3D NULL; size_t i; - if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) =3D=3D 0) { - table =3D qemuMonitorGetBlockInfo(priv->mon); - qemuDomainObjExitMonitor(vm); - } + if (!cold_start) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) =3D=3D 0) { + table =3D qemuMonitorGetBlockInfo(priv->mon); + qemuDomainObjExitMonitor(vm); + } - if (!table) - return -1; + if (!table) + return -1; + } for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; @@ -8661,6 +8664,14 @@ qemuProcessRefreshDisks(virDomainObj *vm, struct qemuDomainDiskInfo *info; const char *entryname =3D disk->info.alias; + /* At startup, when the rest of the detection will be skipped cdro= ms + * have empty trays */ + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) + disk->tray_status =3D VIR_DOMAIN_DISK_TRAY_CLOSED; + + if (!table) + continue; + if (diskpriv->qomName) entryname =3D diskpriv->qomName; @@ -8690,15 +8701,17 @@ qemuProcessRefreshDisks(virDomainObj *vm, /** * qemuProcessRefreshState: * @vm: domain to refresh + * @cold_boot: starting a fresh VM * @asyncJob: async job type * * This function gathers calls to refresh qemu state after startup. This * function is called after a deferred migration finishes so that we can u= pdate * state influenced by the migration stream. */ -int -qemuProcessRefreshState(virDomainObj *vm, - virDomainAsyncJob asyncJob) +static int +qemuProcessRefreshStateInternal(virDomainObj *vm, + bool cold_boot, + virDomainAsyncJob asyncJob) { VIR_DEBUG("Fetching list of active devices"); if (qemuDomainUpdateDeviceList(vm, asyncJob) < 0) @@ -8713,7 +8726,7 @@ qemuProcessRefreshState(virDomainObj *vm, return -1; VIR_DEBUG("Updating disk data"); - if (qemuProcessRefreshDisks(vm, asyncJob) < 0) + if (qemuProcessRefreshDisks(vm, cold_boot, asyncJob) < 0) return -1; VIR_DEBUG("Updating rx-filter data"); @@ -8724,6 +8737,14 @@ qemuProcessRefreshState(virDomainObj *vm, } +int +qemuProcessRefreshState(virDomainObj *vm, + virDomainAsyncJob asyncJob) +{ + return qemuProcessRefreshStateInternal(vm, false, asyncJob); +} + + /** * qemuProcessFinishStartup: * @@ -8836,7 +8857,9 @@ qemuProcessStart(virConnectPtr conn, /* Refresh state of devices from QEMU. During migration this happe= ns * in qemuMigrationDstFinish to ensure that state information is f= ully * transferred. */ - if (qemuProcessRefreshState(vm, asyncJob) < 0) + if (qemuProcessRefreshStateInternal(vm, + !!(flags & VIR_QEMU_PROCESS_ST= ART_COLD), + asyncJob) < 0) goto stop; } @@ -9930,7 +9953,7 @@ qemuProcessReconnect(void *opaque) qemuProcessFiltersInstantiate(obj->def); - if (qemuProcessRefreshDisks(obj, VIR_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshDisks(obj, false, VIR_ASYNC_JOB_NONE) < 0) goto error; /* At this point we've already checked that the startup of the VM was --=20 2.53.0