Do not allow to configure queues and queue size for non-NVMe disks. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_domain.c | 7 ++++++ .../bhyvexml2argv-disk-virtio-queue-opts.xml | 23 +++++++++++++++++++ tests/bhyvexml2argvtest.c | 1 + 3 files changed, 31 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-queue-opts.xml diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 16ca4b1d0f..4c9ed29333 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -316,6 +316,13 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, return -1; } + if ((disk->queues || disk->queue_size) && + disk->bus != VIR_DOMAIN_DISK_BUS_NVME) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queue configuration is only valid for NVMe bus")); + return -1; + } + break; } case VIR_DOMAIN_DEVICE_AUDIO: diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-queue-opts.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-queue-opts.xml new file mode 100644 index 0000000000..1119c37b2b --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-queue-opts.xml @@ -0,0 +1,23 @@ +<domain type='bhyve'> + <name>bhyve</name> + <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> + <memory>219136</memory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file'> + <driver name='file' type='raw' queues='4' queue_size='512'/> + <source file='/tmp/freebsd.img'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </disk> + <interface type='bridge'> + <mac address='52:54:00:bc:85:fe'/> + <model type='virtio'/> + <source bridge="virbr0"/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + </devices> +</domain> diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index f7411ee094..2a785ef8aa 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -267,6 +267,7 @@ mymain(void) DO_TEST_FAILURE("2-nvme-same-controller"); DO_TEST("sata-rotation-rate"); DO_TEST_FAILURE("disk-virtio-rotation-rate"); + DO_TEST_FAILURE("disk-virtio-queue-opts"); /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); -- 2.51.0