There is no guarantee that QEMU and libvirt have been configured with the same prefix. In particular, Homebrew on macOS will pass a different, private prefix for each package version and then use symlinks to make the files for a specific version appear in the usual locations. This works perfectly fine as long as one package doesn't try to go poking around another package's data - which is exactly what libvirt needs to do in order to read and parse the QEMU interop data. qemu_datadir can now be explicitly provided to make this and other uncommon scenarios work. The common scenario, where QEMU and libvirt both use the same prefix, is unaffected. https://gitlab.com/libvirt/libvirt/-/issues/168 Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- meson.build | 6 ++++++ meson_options.txt | 1 + src/qemu/qemu_interop_config.c | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e1e4621868..9022bcfdc9 100644 --- a/meson.build +++ b/meson.build @@ -1685,6 +1685,12 @@ if not get_option('driver_qemu').disabled() endif conf.set_quoted('QEMU_MODDIR', qemu_moddir) + qemu_datadir = get_option('qemu_datadir') + if qemu_datadir == '' + qemu_datadir = datadir / 'qemu' + endif + conf.set_quoted('QEMU_DATADIR', qemu_datadir) + if host_machine.system() in [ 'freebsd', 'darwin' ] default_qemu_user = 'root' default_qemu_group = 'wheel' diff --git a/meson_options.txt b/meson_options.txt index 859ed36b8f..5b43cdbd6b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -62,6 +62,7 @@ option('driver_qemu', type: 'feature', value: 'auto', description: 'QEMU/KVM dri option('qemu_user', type: 'string', value: '', description: 'username to run QEMU system instance as') option('qemu_group', type: 'string', value: '', description: 'groupname to run QEMU system instance as') option('qemu_moddir', type: 'string', value: '', description: 'set the directory where QEMU modules are located') +option('qemu_datadir', type: 'string', value: '', description: 'set the directory where QEMU shared data is located') option('driver_remote', type: 'feature', value: 'auto', description: 'remote driver') option('remote_default_mode', type: 'combo', choices: ['legacy', 'direct'], value: 'direct', description: 'remote driver default mode') option('driver_secrets', type: 'feature', value: 'auto', description: 'local secrets management driver') diff --git a/src/qemu/qemu_interop_config.c b/src/qemu/qemu_interop_config.c index d3f1f34ecf..24db722c0b 100644 --- a/src/qemu/qemu_interop_config.c +++ b/src/qemu/qemu_interop_config.c @@ -80,7 +80,6 @@ qemuBuildFileList(GHashTable *files, const char *dir) return 0; } -#define QEMU_DATADIR DATADIR "/qemu" #define QEMU_CONFDIR SYSCONFDIR "/qemu" int -- 2.31.1