src/conf/domain_validate.c | 8 ++++++ .../disk-blockio-device-lun.x86_64-latest.err | 1 + .../disk-blockio-device-lun.xml | 26 +++++++++++++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 36 insertions(+) create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.xml
From: Peter Krempa <pkrempa@redhat.com>
Overriding the blockio settings for disk passthrough via
"<disk device='lun'>" doesn't make sense and in fact the 'scsi-block'
device in qemu doesn't even expose the appropriate properties:
qemu-system-x86_64: -device {"driver":"scsi-block","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":0,"drive":"libvirt-1-format","id":"scsi0-0-0-0","logical_block_size":512,"physical_block_size":512}: Property 'scsi-block.physical_block_size' not found
Reject those at validation.
Resolves: https://redhat.atlassian.net/browse/RHEL-145937
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
src/conf/domain_validate.c | 8 ++++++
.../disk-blockio-device-lun.x86_64-latest.err | 1 +
.../disk-blockio-device-lun.xml | 26 +++++++++++++++++++
tests/qemuxmlconftest.c | 1 +
4 files changed, 36 insertions(+)
create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err
create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.xml
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index a49156061f..3946f92182 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -786,6 +786,14 @@ virDomainDiskDefValidate(const virDomainDef *def,
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
if (virDomainDiskDefSourceLUNValidate(disk->src) < 0)
return -1;
+
+ if (disk->blockio.logical_block_size > 0 ||
+ disk->blockio.physical_block_size > 0 ||
+ disk->blockio.discard_granularity_specified) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("blockio is not supported with device='lun'"));
+ return -1;
+ }
} else {
if (disk->src->pr) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err b/tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err
new file mode 100644
index 0000000000..508abf7a97
--- /dev/null
+++ b/tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: blockio is not supported with device='lun'
diff --git a/tests/qemuxmlconfdata/disk-blockio-device-lun.xml b/tests/qemuxmlconfdata/disk-blockio-device-lun.xml
new file mode 100644
index 0000000000..862e064d4f
--- /dev/null
+++ b/tests/qemuxmlconfdata/disk-blockio-device-lun.xml
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <disk type='block' device='lun'>
+ <source dev='/dev/something'/>
+ <target dev='sda' bus='scsi'/>
+ <blockio logical_block_size='512' physical_block_size='512' discard_granularity='4096'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 14aa723ec5..4c9b55693a 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1613,6 +1613,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("disk-geometry");
DO_TEST_CAPS_LATEST("disk-blockio");
DO_TEST_CAPS_LATEST("disk-blockio-no-discard");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-blockio-device-lun");
driver.config->storageUseNbdkit = 1;
DO_TEST_CAPS_LATEST_NBDKIT("disk-cdrom-network-nbdkit", QEMU_NBDKIT_CAPS_PLUGIN_CURL);
--
2.53.0
On a Tuesday in 2026, Peter Krempa via Devel wrote:
>From: Peter Krempa <pkrempa@redhat.com>
>
>Overriding the blockio settings for disk passthrough via
>"<disk device='lun'>" doesn't make sense and in fact the 'scsi-block'
>device in qemu doesn't even expose the appropriate properties:
>
> qemu-system-x86_64: -device {"driver":"scsi-block","bus":"scsi0.0","channel":0,"scsi-id":0,"lun":0,"drive":"libvirt-1-format","id":"scsi0-0-0-0","logical_block_size":512,"physical_block_size":512}: Property 'scsi-block.physical_block_size' not found
>
>Reject those at validation.
>
>Resolves: https://redhat.atlassian.net/browse/RHEL-145937
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/domain_validate.c | 8 ++++++
> .../disk-blockio-device-lun.x86_64-latest.err | 1 +
> .../disk-blockio-device-lun.xml | 26 +++++++++++++++++++
> tests/qemuxmlconftest.c | 1 +
> 4 files changed, 36 insertions(+)
> create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.x86_64-latest.err
> create mode 100644 tests/qemuxmlconfdata/disk-blockio-device-lun.xml
>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Jano
© 2016 - 2026 Red Hat, Inc.