]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Introduce qemu_datadir option
authorAndrea Bolognani <abologna@redhat.com>
Mon, 15 Nov 2021 17:13:56 +0000 (18:13 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 18 Nov 2021 14:48:59 +0000 (15:48 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
meson.build
meson_options.txt
src/qemu/qemu_interop_config.c

index e1e462186889986853928b2b0544ec02bf950005..9022bcfdc9513726106a812d77441f369338c2a2 100644 (file)
@@ -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'
index 859ed36b8fe37a1541bab168d4c8c123f67b84e1..5b43cdbd6bbd58c80841722569e2f693defcc3c3 100644 (file)
@@ -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')
index d3f1f34ecf2ea4334b52307e06c7b1398813c59a..24db722c0be39d93ac420510413e9b881107fc03 100644 (file)
@@ -80,7 +80,6 @@ qemuBuildFileList(GHashTable *files, const char *dir)
     return 0;
 }
 
-#define QEMU_DATADIR DATADIR "/qemu"
 #define QEMU_CONFDIR SYSCONFDIR "/qemu"
 
 int