From: Roman Bogorodskiy Date: Sat, 25 Oct 2025 08:15:58 +0000 (+0200) Subject: bhyve: nvme: check if NVMe is supported by bhyve X-Git-Tag: v11.9.0-rc1~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d70b2c783ef20f0ae91b48ab075ee4ab1ed99b9;p=thirdparty%2Flibvirt.git bhyve: nvme: check if NVMe is supported by bhyve For domains using NVMe disks make sure that the bhyve binary supports that by checking capabilities. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 9f2d02b484..14d07909ae 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -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; diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 3c6d530f66..eb4a1eb2fd 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -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");