lib/launch-libvirt.c: avoid libvirt svirt validation error

If a user passes a custom hv, and uses add_libvirt_dom (like
in test820RHBZ912499.py) , this hits a bogus libvirt validation
check which rejects disabling svirt at both domain and disk level.

Work around it by skipping the redundant disk override when
svirt is disabled at the domain level.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson
2025-10-21 08:58:53 -04:00
committed by rwmjones
parent acb785fede
commit 1b791fdcd3

View File

@@ -570,6 +570,13 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
params.is_custom = is_custom_hv (g, data);
params.enable_svirt = !params.is_custom;
/* workaround a libvirt validation bug that rejects disabling selinux
* at domain level and also at disk level, as of libvirt 11.8.0
* https://gitlab.com/libvirt/libvirt/-/issues/826
* */
if (!params.enable_svirt)
data->selinux_norelabel_disks = true;
xml = construct_libvirt_xml (g, &params);
if (!xml)
goto cleanup;