From: Peter Krempa Date: Tue, 3 Feb 2026 17:01:15 +0000 (+0100) Subject: qemu: Drop 'removable' field from 'qemuDomainDiskInfo' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed94a8336ae08ada5f2fd7405b0cae168ae1e3b8;p=thirdparty%2Flibvirt.git qemu: Drop 'removable' field from 'qemuDomainDiskInfo' The only real use was in 'qemuProcessRefreshDiskProps' where it guarded assignment of 'tray' status. Since qemu doesn't actually report any tray status for devices which don't have a tray there's no need for the extra guard. Remove the field completely. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 0f975a22fc..06e2f92ac3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -357,7 +357,6 @@ struct _qemuDomainVcpuPrivate { struct qemuDomainDiskInfo { - bool removable; bool tray; bool tray_open; int io_status; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index bf9e59c0b6..1b05c713ea 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2346,13 +2346,6 @@ qemuMonitorJSONGetBlockInfo(qemuMonitor *mon, return -1; } - if (virJSONValueObjectGetBoolean(dev, "removable", &info.removable) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %1$s value"), - "removable"); - return -1; - } - /* 'tray_open' is present only if the device has a tray */ if (virJSONValueObjectGetBoolean(dev, "tray_open", &info.tray_open) == 0) info.tray = true; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ba8bda0f99..d6ff9c96fc 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9592,13 +9592,11 @@ qemuProcessRefreshDiskProps(virDomainDiskDef *disk, { qemuDomainDiskPrivate *diskpriv = QEMU_DOMAIN_DISK_PRIVATE(disk); - if (info->removable) { - if (info->tray) { - if (info->tray_open) - disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN; - else - disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED; - } + if (info->tray) { + if (info->tray_open) + disk->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN; + else + disk->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED; } diskpriv->tray = info->tray; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 699b75ce2d..b3aca6a6c3 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1353,8 +1353,8 @@ testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo(const void *opaque) static void testQemuMonitorJSONGetBlockInfoPrint(const struct qemuDomainDiskInfo *d) { - VIR_TEST_VERBOSE("removable: %d, tray: %d, tray_open: %d, io_status: %d", - d->removable, d->tray, d->tray_open, d->io_status); + VIR_TEST_VERBOSE("tray: %d, tray_open: %d, io_status: %d", + d->tray, d->tray_open, d->io_status); } @@ -1403,7 +1403,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque) info = g_new0(struct qemuDomainDiskInfo, 1); - info->removable = true; info->tray = true; if (virHashAddEntry(expectedBlockDevices, "ide0-1-0", info) < 0) { @@ -1414,7 +1413,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque) info = g_new0(struct qemuDomainDiskInfo, 1); - info->removable = true; info->tray = true; if (virHashAddEntry(expectedBlockDevices, "ide0-1-1", info) < 0) {