bhyve: capabilities: use full path for emulator

Currently, when the bhyve driver builds capabilities, it uses
just "bhyve" as emulator path. That leads to issues, e.g.
virt-manager uses this value to fill domain's emulator field,
which has to be an absolute path. So that results in a domain
XML that fails validation.

Fix by trying to find "bhyve" in PATH and falling back to
"/usr/sbin/bhyve".

Closes: https://gitlab.com/libvirt/libvirt/-/work_items/899
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Roman Bogorodskiy authored and Jiri Denemark committed 2026-08-03 10:37:32 +02:00
1 parent 984d37aebf
commit eda774c4d4
1 file changed
+2 -1
+2 -1
View File
@@ -48,13 +48,14 @@ virBhyveCapsBuild(void)
virCaps *caps;
virCapsGuest *guest;
virArch hostarch = virArchFromHost();
g_autofree char *binary = virFindFileInPath("bhyve");
if ((caps = virCapabilitiesNew(hostarch,
false, false)) == NULL)
return NULL;
guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM,
hostarch, "bhyve",
hostarch, binary ? binary : "/usr/sbin/bhyve",
NULL, 0, NULL);
virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_BHYVE,