On a Thursday in 2026, Peter Krempa via Devel wrote:
From: Peter Krempa <[email protected]>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 <[email protected]> --- 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 = vm->privateData; @@ -8647,13 +8648,15 @@ qemuProcessRefreshDisks(virDomainObj *vm, g_autoptr(GHashTable) table = NULL; size_t i; - if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { - table = qemuMonitorGetBlockInfo(priv->mon); - qemuDomainObjExitMonitor(vm); - } + if (!cold_start) { + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) { + table = qemuMonitorGetBlockInfo(priv->mon); + qemuDomainObjExitMonitor(vm); + } - if (!table) - return -1; + if (!table) + return -1; + } for (i = 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk = vm->def->disks[i]; @@ -8661,6 +8664,14 @@ qemuProcessRefreshDisks(virDomainObj *vm, struct qemuDomainDiskInfo *info; const char *entryname = disk->info.alias; + /* At startup, when the rest of the detection will be skipped cdroms + * have empty trays */
At cold boot, assume cdroms have closed trays and skip the detection.
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+ disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
+
+ if (!table)
+ continue;
+
if (diskpriv->qomName)
entryname = diskpriv->qomName;
For patches up to this one: Reviewed-by: Ján Tomko <[email protected]> Jano
signature.asc
Description: PGP signature
