]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyve: nvme: check if NVMe is supported by bhyve
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sat, 25 Oct 2025 08:15:58 +0000 (10:15 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 29 Oct 2025 10:45:42 +0000 (11:45 +0100)
For domains using NVMe disks make sure that the bhyve binary supports
that by checking capabilities.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/bhyve/bhyve_command.c
tests/bhyvexml2argvtest.c

index 9f2d02b48476161b72cfa3336e078fb43bcb5354..14d07909ae4e98d93fa2a85129cd4b41dc3a41f5 100644 (file)
@@ -331,7 +331,7 @@ bhyveBuildUSBControllerArgStr(const virDomainDef *def,
 static int
 bhyveBuildNVMeControllerArgStr(const virDomainDef *def,
                                virDomainControllerDef *controller,
-                               struct _bhyveConn *driver G_GNUC_UNUSED,
+                               struct _bhyveConn *driver,
                                virCommand *cmd)
 {
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
@@ -344,6 +344,12 @@ bhyveBuildNVMeControllerArgStr(const virDomainDef *def,
         if (disk->bus != VIR_DOMAIN_DISK_BUS_NVME)
             continue;
 
+        if (!(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_NVME)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Bhyve version does not support NVMe"));
+            return -1;
+        }
+
         if (disk->info.addr.drive.controller != controller->idx)
             continue;
 
index 3c6d530f667509cf647801a3f49de92393164dd8..eb4a1eb2fdff04a41f6f0188eb552e6d1b695d14 100644 (file)
@@ -311,6 +311,9 @@ mymain(void)
     driver.bhyvecaps &= ~BHYVE_CAP_VNC_PASSWORD;
     DO_TEST_FAILURE("vnc-password");
 
+    driver.bhyvecaps &= ~BHYVE_CAP_NVME;
+    DO_TEST_FAILURE("nvme");
+
     driver.config->bhyveloadTimeout = 300;
     driver.config->bhyveloadTimeoutKill = 20;
     DO_TEST("bhyveload-timeout");