lib/launch-libvirt.c: check if g->hv symlink matches libvirt default

On fedora, ./configure will set QEMU=qemu-kvm, but libvirt
domcaps will default to qemu-system-x86_64. The former is a symlink
to the latter, but libguestfs doesn't know that, so determines
the user requested a non-default hv override and changes some
settings as a result (like disabling svirt).

Check for the symlink case and consider it a non-custom config
if realpath matches libvirt's default

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson
2025-10-21 08:54:01 -04:00
committed by rwmjones
parent 55ea21d4b3
commit acb785fede

View File

@@ -869,11 +869,18 @@ parse_domcapabilities (guestfs_h *g, const char *domcapabilities_xml,
static int
is_custom_hv (guestfs_h *g, struct backend_libvirt_data *data)
{
CLEANUP_FREE char *rawpath = NULL;
if (STREQ (g->hv, data->default_qemu))
return 0;
debug (g, "user passed custom hv=%s, libvirt default=%s",
g->hv, data->default_qemu);
/* ignore error here, let guest startup fail later */
rawpath = realpath(g->hv, NULL);
if (rawpath && STREQ (rawpath, data->default_qemu))
return 0;
debug (g, "user passed custom hv=%s (realpath=%s) libvirt default=%s",
g->hv, rawpath, data->default_qemu);
return 1;
}