On Mon, Nov 10, 2025 at 18:55:39 +0100, Roman Bogorodskiy wrote:
> 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 <[email protected]>
> ---
> src/conf/domain_validate.c | 12 ------------
> src/qemu/qemu_driver.c | 15 +++++++++++++++
> src/qemu/qemu_validate.c | 14 ++++++++++++++
> 3 files changed, 29 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/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index a1b1edcbbf..88c2b4edc3 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6745,6 +6745,21 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef,
> _("target %1$s already exists"), disk->dst);
> return -1;
> }
> +
> + 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;
> + }
> + }
This is dead code; virDomainDeviceDefParse calls
virDomainDeviceDefValidate which calls the driver specific callback.
> +
> if (virDomainDiskTranslateSourcePool(disk) < 0)
> return -1;
> if (qemuCheckDiskConfigAgainstDomain(vmdef, disk) < 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.51.0
>