]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: domain_validate: make disk queue configuration driver specific
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sun, 9 Nov 2025 09:10:54 +0000 (10:10 +0100)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Tue, 11 Nov 2025 17:28:57 +0000 (18:28 +0100)
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 <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_validate.c
src/libxl/libxl_domain.c
src/qemu/qemu_validate.c

index 17955decc02edaed8a59ed3b4dcfc96ed1acb033..8085d782c5c5d6f66a1a91f16c378b46585f12bf 100644 (file)
@@ -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"));
index 311c3915c704a8369a2d0d88a07539f9f12bf48f..9842d6fece8fd76130fb8a215e74ef457664ad48 100644 (file)
@@ -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;
 }
 
index 747e54bf445fe5b8126911b8717ea1bfe00704a6..5008391707bd7d24a235a729c8033a4988ca51a8 100644 (file)
@@ -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;
 }