On Mon, Jun 23, 2025 at 21:59:15 +0200, Peter Krempa wrote:
From: Peter Krempa <pkrempa(a)redhat.com>
While the 'usb-storage' based disks use the USB address directly, with
'usb-bot' the USB address is on the "controller" part of the device
and
the 'scsi-hd/cd' device will use a 'drive' address from qemu's PoV.
Since we do not want to expose the 'usb-bot' as explicit controller
to preserve compatibility with existing configs we plan to upgrade
implement the formatter for 'drive' address when the "diskbus"
property
is VIR_DOMAIN_DISK_BUS_USB.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4de6016784..910242a389 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -545,8 +545,21 @@ qemuBuildDeviceAddresDriveProps(virJSONValue *props,
return -1;
break;
- case VIR_DOMAIN_DISK_BUS_VIRTIO:
case VIR_DOMAIN_DISK_BUS_USB:
+ /* Device info with type VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE and
+ * VIR_DOMAIN_DISK_BUS_USB diskbus is an internal representation
+ * for the device address for 'usb-bot'. */
+ bus = g_strdup_printf("%s.0", info->alias);
+
+ if (virJSONValueObjectAdd(&props,
+ "s:bus", bus,
+ "u:scsi-id",
info->addr.drive.target,
+ "u:lun", info->addr.drive.unit,
+ NULL) < 0)
+ return -1;
+ break;
The code is indented one level more than it should be.
+
+ case VIR_DOMAIN_DISK_BUS_VIRTIO:
case VIR_DOMAIN_DISK_BUS_XEN:
case VIR_DOMAIN_DISK_BUS_UML:
case VIR_DOMAIN_DISK_BUS_SD:
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>