From 52bddfd65caa308c710c15ba4326e717f3fd1c1f Mon Sep 17 00:00:00 2001 From: Roman Bogorodskiy Date: Sun, 9 Nov 2025 10:10:54 +0100 Subject: [PATCH] conf: domain_validate: make disk queue configuration driver specific Currently, virDomainDiskDefValidate() allows to configure disks' number of queues and queue size for virtio disks only. However, the bhyve driver allows to configure these for the NVMe disks, so make this check driver-specific. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 12 ------------ src/libxl/libxl_domain.c | 18 ++++++++++++++++++ src/qemu/qemu_validate.c | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 17955decc0..8085d782c5 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -835,18 +835,6 @@ virDomainDiskDefValidate(const virDomainDef *def, return -1; } - if (disk->queues) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("queues attribute in disk driver element is only supported for virtio bus")); - return -1; - } - - if (disk->queue_size) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("queue_size attribute in disk driver is only supported for virtio bus")); - return -1; - } - if (disk->event_idx != VIR_TRISTATE_SWITCH_ABSENT) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk event_idx mode supported only for virtio bus")); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 311c3915c7..9842d6fece 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -379,6 +379,24 @@ libxlDomainDefValidate(const virDomainDef *def, } } + for (i = 0; i < def->ndisks; i++) { + virDomainDiskDef *disk = def->disks[i]; + + if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { + if (disk->queues) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queues attribute in disk driver element is only supported for virtio bus")); + return -1; + } + + if (disk->queue_size) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queue_size attribute in disk driver is only supported for virtio bus")); + return -1; + } + } + } + return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 747e54bf44..5008391707 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3698,6 +3698,20 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, } } + if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { + if (disk->queues) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queues attribute in disk driver element is only supported for virtio bus")); + return -1; + } + + if (disk->queue_size) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queue_size attribute in disk driver is only supported for virtio bus")); + return -1; + } + } + return 0; } -- 2.47.3