From: Michal Privoznik Date: Tue, 8 Nov 2022 07:08:16 +0000 (+0100) Subject: qemu: Assume QEMU_CAPS_BLOCKIO X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=718721f0f9d33aa8abafd71bfb9ac1cfef95dc3e;p=libvirt.git qemu: Assume QEMU_CAPS_BLOCKIO Introduced in QEMU's commit of v0.13.0-rc0~1072 the .logical_block_size attribute of virtio-blk device is always available for all QEMU versions we support (4.2.0, currently). Therefore, we can assume the capability is always set and thus doesn't need to be checked for. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 256ef4912c..b0c9fb7059 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1751,8 +1751,8 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, g_autofree char *chardev = NULL; g_autofree char *drive = NULL; unsigned int bootindex = 0; - unsigned int logical_block_size = 0; - unsigned int physical_block_size = 0; + unsigned int logical_block_size = disk->blockio.logical_block_size; + unsigned int physical_block_size = disk->blockio.physical_block_size; g_autoptr(virJSONValue) wwn = NULL; g_autofree char *serial = NULL; virTristateSwitch removable = VIR_TRISTATE_SWITCH_ABSENT; @@ -1886,11 +1886,6 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, if (disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) bootindex = disk->info.effectiveBootIndex; - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKIO)) { - logical_block_size = disk->blockio.logical_block_size; - physical_block_size = disk->blockio.physical_block_size; - } - if (disk->wwn) { unsigned long long w = 0;