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>
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,