build: Add option to control building libvirtd

Add meson option 'libvirtd' to control building of the monolithic
libvirtd, independent from the stateful, daemon-based drivers. E.g.

meson configure -Dlibvirtd=disabled build-dir

The new option defaults to 'auto' and will be enabled when 'driver_libvirtd'
is enabled. Setting libvirtd=disabled skips building the libvirtd binary,
and related items such as config files, systemd units, etc.

The existing option 'driver_libvirtd' controls building libvirtd and all
stateful, daemon-based drivers, making it unsuitable for disabling only
the monolithic daemon. Additionally, 'driver_libvirtd' is used by the
various libvirt-ci projects to produce a minimalistic build.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jim Fehlig committed 2026-07-06 11:39:53 -06:00
1 parent 48b251c4f7
commit 4d7cfb4cdf
6 files changed
+60 -44

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ docs_man_files = [
{ 'name': 'virt-qemu-sev-validate', 'section': '1', 'install': conf.has('WITH_QEMU') },
{ 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_MONOLITHIC_LIBVIRTD') },
{ 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') },
{ 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') },
{ 'name': 'virtbhyved', 'section': '8', 'install': conf.has('WITH_BHYVE') },
+5 -1
View File
@@ -1483,7 +1483,6 @@ if udev_dep.found() and not pciaccess_dep.found()
error('You must install the pciaccess module to build with udev')
endif
# build driver options
remote_default_mode = get_option('remote_default_mode')
@@ -1513,6 +1512,10 @@ if not get_option('driver_libvirtd').disabled()
endif
endif
if not get_option('libvirtd').disabled() and conf.has('WITH_LIBVIRTD')
conf.set('WITH_MONOLITHIC_LIBVIRTD', 1)
endif
if not get_option('driver_bhyve').disabled() and host_machine.system() == 'freebsd'
conf.set('WITH_BHYVE', 1)
elif get_option('driver_bhyve').enabled()
@@ -2252,6 +2255,7 @@ driver_summary = {
'Libvirtd': conf.has('WITH_LIBVIRTD'),
'libxl': conf.has('WITH_LIBXL'),
'LXC': conf.has('WITH_LXC'),
'Monolithic libvirtd': conf.has('WITH_MONOLITHIC_LIBVIRTD'),
'Network': conf.has('WITH_NETWORK'),
'OpenVZ': conf.has('WITH_OPENVZ'),
'QEMU': conf.has('WITH_QEMU'),
+2
View File
@@ -52,6 +52,8 @@ option('udev', type: 'feature', value: 'auto', description: 'udev support')
option('wireshark_dissector', type: 'feature', value: 'auto', description: 'wireshark support')
option('wireshark_plugindir', type: 'string', value: '', description: 'wireshark plugins directory for use when installing wireshark plugin')
# build monolithic daemon option
option('libvirtd', type: 'feature', value: 'auto', description: 'monolithic libvirt daemon')
# build driver options
option('driver_bhyve', type: 'feature', value: 'auto', description: 'bhyve driver')
+47 -40
View File
@@ -134,9 +134,14 @@ logrotate_files = [
'libvirtd.qemu',
'libvirtd.lxc',
'libvirtd.libxl',
'libvirtd',
]
if conf.has('WITH_MONOLITHIC_LIBVIRTD')
logrotate_files += [
'libvirtd',
]
endif
if conf.has('WITH_REMOTE')
remote_driver_lib = static_library(
'virt_remote_driver',
@@ -176,47 +181,49 @@ if conf.has('WITH_REMOTE')
if conf.has('WITH_LIBVIRTD')
guest_unit_files += files('virt-guest-shutdown.target')
virt_daemons += {
'name': 'libvirtd',
'c_args': [
'-DSOCK_PREFIX="libvirt"',
'-DDAEMON_NAME="libvirtd"',
'-DWITH_IP',
'-DLIBVIRTD',
],
}
if conf.has('WITH_MONOLITHIC_LIBVIRTD')
virt_daemons += {
'name': 'libvirtd',
'c_args': [
'-DSOCK_PREFIX="libvirt"',
'-DDAEMON_NAME="libvirtd"',
'-DWITH_IP',
'-DLIBVIRTD',
],
}
virt_daemon_confs += {
'name': 'libvirtd',
'with_ip': true,
}
virt_daemon_confs += {
'name': 'libvirtd',
'with_ip': true,
}
virt_daemon_units += {
'service': 'libvirtd',
'name': 'legacy monolithic',
'service_in': files('libvirtd.service.in'),
'service_extra_in': [
files('libvirtd.service.extra.in'),
systemd_service_limitnofile_extra_in,
systemd_service_tasksmax_extra_in,
systemd_service_limitmemlock_extra_in,
],
'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ],
'socket_in': files('libvirtd.socket.in'),
'socket_ro_in': files('libvirtd-ro.socket.in'),
'socket_admin_in': files('libvirtd-admin.socket.in'),
'socket_tcp_in': files('libvirtd-tcp.socket.in'),
'socket_tls_in': files('libvirtd-tls.socket.in'),
'socket_extra_in': [
files('libvirtd.socket.extra.in'),
],
}
virt_daemon_units += {
'service': 'libvirtd',
'name': 'legacy monolithic',
'service_in': files('libvirtd.service.in'),
'service_extra_in': [
files('libvirtd.service.extra.in'),
systemd_service_limitnofile_extra_in,
systemd_service_tasksmax_extra_in,
systemd_service_limitmemlock_extra_in,
],
'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ],
'socket_in': files('libvirtd.socket.in'),
'socket_ro_in': files('libvirtd-ro.socket.in'),
'socket_admin_in': files('libvirtd-admin.socket.in'),
'socket_tcp_in': files('libvirtd-tcp.socket.in'),
'socket_tls_in': files('libvirtd-tls.socket.in'),
'socket_extra_in': [
files('libvirtd.socket.extra.in'),
],
}
openrc_init_files += {
'name': 'libvirtd',
'in_file': files('libvirtd.init.in'),
'confd': files('libvirtd.confd'),
}
openrc_init_files += {
'name': 'libvirtd',
'in_file': files('libvirtd.init.in'),
'confd': files('libvirtd.confd'),
}
endif
virt_daemons += {
'name': 'virtproxyd',
@@ -337,7 +344,7 @@ endif
# The monolithic libvirt daemon only attempts to load the
# secrets encryption credentials if the secret driver is enabled
if conf.has('WITH_SECRETS') and init_script == 'systemd'
if conf.has('WITH_MONOLITHIC_LIBVIRTD') and conf.has('WITH_SECRETS') and init_script == 'systemd'
secret_dropin_conf = configuration_data({
'localstatedir': localstatedir,
})
+4 -1
View File
@@ -1,10 +1,13 @@
apparmor_gen_profiles = [
'usr.lib.libvirt.virt-aa-helper',
'usr.sbin.libvirtd',
'usr.sbin.virtqemud',
'usr.sbin.virtxend',
]
if conf.has('WITH_MONOLITHIC_LIBVIRTD')
apparmor_gen_profiles += ['usr.sbin.libvirtd']
endif
apparmor_gen_profiles_conf = configuration_data({
'sysconfdir': sysconfdir,
'sbindir': sbindir,
+1 -1
View File
@@ -734,7 +734,7 @@ if conf.has('WITH_TEST')
]
endif
if conf.has('WITH_LIBVIRTD')
if conf.has('WITH_MONOLITHIC_LIBVIRTD')
test('libvirtd fail with missing config',
libvirtd_prog,
args: [ '--config=no-such-conf', '--timeout=5' ],