[PATCH 37/48] qemu: Assume QEMU_CAPS_BLOCKIO

Michal Privoznik mprivozn at redhat.com
Tue Nov 8 08:29:39 UTC 2022


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 <mprivozn at redhat.com>
---
 src/qemu/qemu_command.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

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;
 
-- 
2.37.4



More information about the libvir-list mailing list