For domains using NVMe disks make sure that the bhyve binary supports
that by checking capabilities.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
src/bhyve/bhyve_command.c | 8 +++++++-
tests/bhyvexml2argvtest.c | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
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");
--
2.51.0