From: Jim Fehlig <jfehlig@suse.com> Attempting to build with -Ddriver_libvirtd=disabled fails in many locations. E.g. configuring the build with -Ddriver_qemu=enabled -Ddriver_libxl=enabled -Ddriver_lxc=enabled \ -Ddriver_libvirtd=disabled Results in the following failure ../meson.build:1590:2: ERROR: Problem encountered: libvirtd is required for libxenlight Several modular daemons and the common components are needlessly wrapped in 'WITH_LIBVIRTD' conditionals. Remove the conditionals and other unneeded dependencies on the monolithic daemon. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- docs/manpages/meson.build | 10 +- meson.build | 209 +++++++++++++--------------- meson_options.txt | 14 +- src/access/meson.build | 3 - src/locking/meson.build | 281 +++++++++++++++++++------------------- src/logging/meson.build | 104 +++++++------- src/meson.build | 200 +++++++++++++-------------- src/remote/meson.build | 174 +++++++++++------------ src/security/meson.build | 2 +- src/util/meson.build | 24 ++-- tools/meson.build | 26 ++-- 11 files changed, 503 insertions(+), 544 deletions(-) diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build index 6504e68a71..9d11d153f7 100644 --- a/docs/manpages/meson.build +++ b/docs/manpages/meson.build @@ -22,19 +22,19 @@ docs_man_files = [ { 'name': 'virt-xml-validate', 'section': '1', 'install': true }, { 'name': 'virt-qemu-sev-validate', 'section': '1', 'install': conf.has('WITH_QEMU') }, - { 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, + { 'name': 'libvirt-guests', 'section': '8', 'install': true }, { 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, { 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') }, - { 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, + { 'name': 'virt-ssh-helper', 'section': '8', 'install': true }, { 'name': 'virtbhyved', 'section': '8', 'install': conf.has('WITH_BHYVE') }, { 'name': 'virtinterfaced', 'section': '8', 'install': conf.has('WITH_INTERFACE') }, - { 'name': 'virtlockd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, - { 'name': 'virtlogd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, + { 'name': 'virtlockd', 'section': '8', 'install': true }, + { 'name': 'virtlogd', 'section': '8', 'install': true }, { 'name': 'virtlxcd', 'section': '8', 'install': conf.has('WITH_LXC') }, { 'name': 'virtnetworkd', 'section': '8', 'install': conf.has('WITH_NETWORK') }, { 'name': 'virtnodedevd', 'section': '8', 'install': conf.has('WITH_NODE_DEVICES') }, { 'name': 'virtnwfilterd', 'section': '8', 'install': conf.has('WITH_NWFILTER') }, - { 'name': 'virtproxyd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, + { 'name': 'virtproxyd', 'section': '8', 'install': true }, { 'name': 'virtqemud', 'section': '8', 'install': conf.has('WITH_QEMU') }, { 'name': 'virtsecretd', 'section': '8', 'install': conf.has('WITH_SECRETS') }, { 'name': 'virtstoraged', 'section': '8', 'install': conf.has('WITH_STORAGE') }, diff --git a/meson.build b/meson.build index b30e9136a2..8312bfb6e2 100644 --- a/meson.build +++ b/meson.build @@ -1532,13 +1532,13 @@ elif get_option('driver_hyperv').enabled() error('openwsman is required for the Hyper-V driver') endif -if not get_option('driver_interface').disabled() and conf.has('WITH_LIBVIRTD') and (udev_dep.found() or conf.has('WITH_NETCF')) +if not get_option('driver_interface').disabled() and (udev_dep.found() or conf.has('WITH_NETCF')) conf.set('WITH_INTERFACE', 1) elif get_option('driver_interface').enabled() - error('Requested the Interface driver without netcf or udev and libvirtd support') + error('Requested the Interface driver without netcf or udev support') endif -if not get_option('driver_libxl').disabled() and conf.has('WITH_LIBVIRTD') +if not get_option('driver_libxl').disabled() libxl_version = '4.9.0' libxl_dep = dependency('xenlight', version: '>=' + libxl_version, required: get_option('driver_libxl')) @@ -1586,14 +1586,12 @@ if not get_option('driver_libxl').disabled() and conf.has('WITH_LIBVIRTD') conf.set('WITH_LIBXL', 1) endif -elif get_option('driver_libxl').enabled() - error('libvirtd is required for libxenlight') endif -if not get_option('driver_lxc').disabled() and host_machine.system() == 'linux' and conf.has('WITH_LIBVIRTD') +if not get_option('driver_lxc').disabled() and host_machine.system() == 'linux' conf.set('WITH_LXC', 1) elif get_option('driver_lxc').enabled() - error('linux and remote_driver are required for LXC') + error('linux is required for LXC') endif if not get_option('driver_ch').disabled() @@ -1606,13 +1604,6 @@ if not get_option('driver_ch').disabled() endif endif - if not conf.has('WITH_LIBVIRTD') - use_ch = false - if get_option('driver_ch').enabled() - error('libvirtd is required to build Cloud-Hypervisor driver') - endif - endif - if not json_c_dep.found() use_ch = false if get_option('driver_ch').enabled() @@ -1645,7 +1636,7 @@ if not get_option('driver_ch').disabled() endif endif -if not get_option('driver_network').disabled() and conf.has('WITH_LIBVIRTD') +if not get_option('driver_network').disabled() conf.set('WITH_NETWORK', 1) firewall_backend_priority = get_option('firewall_backend_priority') @@ -1672,11 +1663,9 @@ if not get_option('driver_network').disabled() and conf.has('WITH_LIBVIRTD') endforeach conf.set('FIREWALL_BACKENDS', ', '.join(backends)) -elif get_option('driver_network').enabled() - error('libvirtd must be enabled to build the network driver') endif -if udev_dep.found() and conf.has('WITH_LIBVIRTD') +if udev_dep.found() conf.set('WITH_NODE_DEVICES', 1) endif @@ -1696,13 +1685,6 @@ if not get_option('driver_qemu').disabled() endif endif - if not conf.has('WITH_LIBVIRTD') - use_qemu = false - if get_option('driver_qemu').enabled() - error('libvirtd is required to build QEMU driver') - endif - endif - if use_qemu conf.set('WITH_QEMU', 1) @@ -1765,7 +1747,7 @@ if not get_option('driver_qemu').disabled() endif endif -if not get_option('driver_secrets').disabled() and conf.has('WITH_LIBVIRTD') +if not get_option('driver_secrets').disabled() conf.set('WITH_SECRETS', 1) endif @@ -1773,7 +1755,7 @@ if not get_option('driver_test').disabled() conf.set('WITH_TEST', 1) endif -if not get_option('driver_vbox').disabled() and conf.has('WITH_LIBVIRTD') +if not get_option('driver_vbox').disabled() conf.set('WITH_VBOX', 1) conf.set_quoted('VBOX_XPCOMC_DIR', get_option('vbox_xpcomc_dir')) endif @@ -1810,111 +1792,107 @@ endif use_storage = false -if conf.has('WITH_LIBVIRTD') - if not get_option('storage_dir').disabled() - use_storage = true - conf.set('WITH_STORAGE_DIR', 1) - endif +if not get_option('storage_dir').disabled() + use_storage = true + conf.set('WITH_STORAGE_DIR', 1) +endif - if not get_option('storage_disk').disabled() and libparted_dep.found() - use_storage = true - conf.set('WITH_STORAGE_DISK', 1) - elif get_option('storage_disk').enabled() - error('You must install libparted to compile libvirt with disk storage driver') - endif +if not get_option('storage_disk').disabled() and libparted_dep.found() + use_storage = true + conf.set('WITH_STORAGE_DISK', 1) +elif get_option('storage_disk').enabled() + error('You must install libparted to compile libvirt with disk storage driver') +endif - if not get_option('storage_fs').disabled() - fs_enable = true +if not get_option('storage_fs').disabled() + fs_enable = true + + # storage-fs does not work on macOS + if host_machine.system() == 'darwin' + fs_enable = false + endif - # storage-fs does not work on macOS - if host_machine.system() == 'darwin' + if fs_enable and not cc.check_header('mntent.h') + if get_option('storage_fs').enabled() + error('<mntent.h> is required for the FS storage driver') + else fs_enable = false endif - - if fs_enable and not cc.check_header('mntent.h') - if get_option('storage_fs').enabled() - error('<mntent.h> is required for the FS storage driver') - else - fs_enable = false - endif - endif - - if fs_enable - use_storage = true - - conf.set('WITH_STORAGE_FS', 1) - endif endif - if not get_option('storage_gluster').disabled() and glusterfs_dep.found() + if fs_enable use_storage = true - conf.set('WITH_STORAGE_GLUSTER', 1) - elif get_option('storage_gluster').enabled() - error('Need glusterfs (libgfapi) for gluster storage driver') - endif - if not get_option('storage_iscsi').disabled() and host_machine.system() == 'linux' - use_storage = true - conf.set('WITH_STORAGE_ISCSI', 1) - elif get_option('storage_iscsi').enabled() - error('Linux host needed for iSCSI storage driver using iscsiadm') - endif - - if not get_option('storage_iscsi_direct').disabled() and libiscsi_dep.found() - use_storage = true - conf.set('WITH_STORAGE_ISCSI_DIRECT', 1) - elif get_option('storage_iscsi_direct').enabled() - error('Need libiscsi for iscsi-direct storage driver') + conf.set('WITH_STORAGE_FS', 1) endif +endif - if not get_option('storage_lvm').disabled() and host_machine.system() == 'linux' - lvm_enable = true - use_storage = true - conf.set('WITH_STORAGE_LVM', 1) - elif get_option('storage_lvm').enabled() - error('Linux host needed for LVM storage driver') - endif +if not get_option('storage_gluster').disabled() and glusterfs_dep.found() + use_storage = true + conf.set('WITH_STORAGE_GLUSTER', 1) +elif get_option('storage_gluster').enabled() + error('Need glusterfs (libgfapi) for gluster storage driver') +endif - if not get_option('storage_mpath').disabled() and host_machine.system() == 'linux' and devmapper_dep.found() - use_storage = true - conf.set('WITH_STORAGE_MPATH', 1) - elif get_option('storage_mpath').enabled() - error('mpath storage driver is supported only on Linux and you must install libdevmapper') - endif +if not get_option('storage_iscsi').disabled() and host_machine.system() == 'linux' + use_storage = true + conf.set('WITH_STORAGE_ISCSI', 1) +elif get_option('storage_iscsi').enabled() + error('Linux host needed for iSCSI storage driver using iscsiadm') +endif - if not get_option('storage_rbd').disabled() and rbd_dep.found() - use_storage = true - conf.set('WITH_STORAGE_RBD', 1) - elif get_option('storage_rbd').enabled() - error('You must install the librbd library & headers to compile libvirt') - endif +if not get_option('storage_iscsi_direct').disabled() and libiscsi_dep.found() + use_storage = true + conf.set('WITH_STORAGE_ISCSI_DIRECT', 1) +elif get_option('storage_iscsi_direct').enabled() + error('Need libiscsi for iscsi-direct storage driver') +endif + if not get_option('storage_lvm').disabled() and host_machine.system() == 'linux' + lvm_enable = true + use_storage = true + conf.set('WITH_STORAGE_LVM', 1) +elif get_option('storage_lvm').enabled() + error('Linux host needed for LVM storage driver') +endif - if not get_option('storage_scsi').disabled() and host_machine.system() == 'linux' - use_storage = true - conf.set('WITH_STORAGE_SCSI', 1) - endif +if not get_option('storage_mpath').disabled() and host_machine.system() == 'linux' and devmapper_dep.found() + use_storage = true + conf.set('WITH_STORAGE_MPATH', 1) +elif get_option('storage_mpath').enabled() + error('mpath storage driver is supported only on Linux and you must install libdevmapper') +endif + if not get_option('storage_rbd').disabled() and rbd_dep.found() + use_storage = true + conf.set('WITH_STORAGE_RBD', 1) +elif get_option('storage_rbd').enabled() + error('You must install the librbd library & headers to compile libvirt') +endif - if not get_option('storage_vstorage').disabled() - vstorage_enable = true - if host_machine.system() != 'linux' - vstorage_enable = false - if get_option('storage_vstorage').enabled() - error('Vstorage is supported only on Linux') - endif - endif +if not get_option('storage_scsi').disabled() and host_machine.system() == 'linux' + use_storage = true + conf.set('WITH_STORAGE_SCSI', 1) +endif - if vstorage_enable - use_storage = true - conf.set('WITH_STORAGE_VSTORAGE', 1) +if not get_option('storage_vstorage').disabled() + vstorage_enable = true + if host_machine.system() != 'linux' + vstorage_enable = false + if get_option('storage_vstorage').enabled() + error('Vstorage is supported only on Linux') endif endif - if not get_option('storage_zfs').disabled() + if vstorage_enable use_storage = true - conf.set('WITH_STORAGE_ZFS', 1) + conf.set('WITH_STORAGE_VSTORAGE', 1) endif endif +if not get_option('storage_zfs').disabled() + use_storage = true + conf.set('WITH_STORAGE_ZFS', 1) +endif + if use_storage conf.set('WITH_STORAGE', 1) endif @@ -1931,12 +1909,10 @@ if chrdev_lock_files != '' endif driver_modules_flags = [] -if conf.has('WITH_LIBVIRTD') - if not conf.has('WITH_DLFCN_H') or not dlopen_dep.found() - error('You must have dlfcn.h / dlopen() support to build driver modules') - endif - driver_modules_flags = libvirt_export_dynamic +if not conf.has('WITH_DLFCN_H') or not dlopen_dep.found() + error('You must have dlfcn.h / dlopen() support to build driver modules') endif +driver_modules_flags = libvirt_export_dynamic if host_machine.system() == 'linux' dtrace_prog = find_program('dtrace', required: get_option('dtrace'), dirs: libvirt_sbin_path) @@ -2026,9 +2002,8 @@ elif get_option('numad').enabled() error('You must have a Linux host with numactl enabled for numad support.') endif -# nwfilter should only be compiled for linux, and only if the -# libvirt daemon is also being compiled -if conf.has('WITH_LIBVIRTD') and host_machine.system() == 'linux' +# nwfilter should only be compiled for linux +if host_machine.system() == 'linux' conf.set('WITH_NWFILTER', 1) endif diff --git a/meson_options.txt b/meson_options.txt index e12ace4e11..2dc15855ad 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -59,22 +59,22 @@ option('driver_bhyve', type: 'feature', value: 'auto', description: 'bhyve drive option('driver_esx', type: 'feature', value: 'auto', description: 'esx driver') # dep:openwsman option('driver_hyperv', type: 'feature', value: 'auto', description: 'Hyper-V driver') -# dep:pciaccess dep:udev dep:driver_remote dep:driver_libvirtd +# dep:pciaccess dep:udev dep:driver_remote option('driver_interface', type: 'feature', value: 'auto', description: 'host interface driver') # dep:driver_remote option('driver_libvirtd', type: 'feature', value: 'auto', description: 'libvirtd driver') -# dep:driver_remote dep:driver_libvirtd +# dep:driver_remote option('driver_libxl', type: 'feature', value: 'auto', description: 'libxenlight driver') -# dep:driver_remote dep:driver_libvirtd +# dep:driver_remote option('driver_lxc', type: 'feature', value: 'auto', description: 'Linux Container driver') -# dep:curl dep:json_c dep:driver_remote dep:driver_libvirtd +# dep:curl dep:json_c dep:driver_remote option('driver_ch', type: 'feature', value: 'auto', description: 'Cloud-Hypervisor driver') option('ch_user', type: 'string', value: '', description: 'username to run Cloud-Hypervisor system instance as') option('ch_group', type: 'string', value: '', description: 'groupname to run Cloud-Hypervisor system instance as') -# dep:driver_remote dep:driver_libvirtd +# dep:driver_remote option('driver_network', type: 'feature', value: 'auto', description: 'virtual network driver') option('driver_openvz', type: 'feature', value: 'auto', description: 'OpenVZ driver') -# dep:json_c dep:driver_remote dep:driver_libvirtd +# dep:json_c dep:driver_remote option('driver_qemu', type: 'feature', value: 'auto', description: 'QEMU/KVM driver') 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') @@ -122,7 +122,7 @@ option('host_validate', type: 'feature', value: 'auto', description: 'build virt option('init_script', type: 'combo', choices: ['systemd', 'openrc', 'check', 'none'], value: 'check', description: 'Style of init script to install') option('loader_nvram', type: 'string', value: '', description: 'Pass list of pairs of <loader>:<nvram> paths. Both pairs and list items are separated by a colon.') option('login_shell', type: 'feature', value: 'auto', description: 'build virt-login-shell') -# dep:json_c dep:driver_network dep:libvirtd +# dep:json_c dep:driver_network option('nss', type: 'feature', value: 'auto', description: 'enable Name Service Switch plugin for resolving guest IP addresses') # dep:numactl option('numad', type: 'feature', value: 'auto', description: 'use numad to manage CPU placement dynamically') diff --git a/src/access/meson.build b/src/access/meson.build index d1336c0093..84b2da861c 100644 --- a/src/access/meson.build +++ b/src/access/meson.build @@ -78,8 +78,6 @@ access_generated += polgen if conf.has('WITH_POLKIT') access_sources += access_polkit_sources - if conf.has('WITH_LIBVIRTD') - i18n.merge_file( input: polgen, output: 'org.libvirt.api.policy', @@ -88,7 +86,6 @@ if conf.has('WITH_POLKIT') install: true, install_dir: polkitactionsdir, ) - endif endif access_generated += access_gen_sources diff --git a/src/locking/meson.build b/src/locking/meson.build index f8d12c481f..4e1d673d51 100644 --- a/src/locking/meson.build +++ b/src/locking/meson.build @@ -76,185 +76,182 @@ lock_driver_lib = static_library( libvirt_libs += lock_driver_lib -if conf.has('WITH_LIBVIRTD') - lockd_lib_impl = static_library( - 'lockd_impl', - [ - files(lock_driver_lockd_sources), - lock_protocol_generated, - ], - include_directories: [ - conf_inc_dir, - ], - dependencies: [ - rpc_dep, - sasl_dep, - src_dep, - xdr_dep, - ], - ) +lockd_lib_impl = static_library( + 'lockd_impl', + [ + files(lock_driver_lockd_sources), + lock_protocol_generated, + ], + include_directories: [ + conf_inc_dir, + ], + dependencies: [ + rpc_dep, + sasl_dep, + src_dep, + xdr_dep, + ], +) - check_protocols += { - 'name': 'lock_protocol', - 'lib': lockd_lib_impl, - } +check_protocols += { + 'name': 'lock_protocol', + 'lib': lockd_lib_impl, +} + virt_modules += { + 'name': 'lockd', + 'name_prefix': '', + 'sources': [ + dtrace_gen_objects, + ], + 'link_whole': [ + lockd_lib_impl, + ], + 'link_args': [ + libvirt_no_undefined, + ], + 'install_dir': lock_driver_install_dir, +} +if conf.has('WITH_SANLOCK') virt_modules += { - 'name': 'lockd', + 'name': 'sanlock', 'name_prefix': '', 'sources': [ - dtrace_gen_objects, + files(sanlock_sources), ], - 'link_whole': [ - lockd_lib_impl, + 'deps': [ + sanlock_dep, ], 'link_args': [ libvirt_no_undefined, ], 'install_dir': lock_driver_install_dir, } +endif - if conf.has('WITH_SANLOCK') - virt_modules += { - 'name': 'sanlock', - 'name_prefix': '', - 'sources': [ - files(sanlock_sources), - ], - 'deps': [ - sanlock_dep, - ], - 'link_args': [ - libvirt_no_undefined, - ], - 'install_dir': lock_driver_install_dir, - } - endif +virt_daemons += { + 'name': 'virtlockd', + 'sources': [ + lock_daemon_sources, + lock_daemon_generated, + lock_protocol_generated, + ], + 'include': [ + include_directories('.'), + ], +} - virt_daemons += { - 'name': 'virtlockd', +virt_daemon_units += { + 'service': 'virtlockd', + 'name': 'locking', + 'service_in': files('virtlockd.service.in'), + 'service_extra_in': [ + files('virtlockd.service.extra.in'), + systemd_service_oomscoreadjust_extra_in, + systemd_service_limitnofile_extra_in, + ], + 'sockets': [ 'main', 'admin' ], + 'socket_in': files('virtlockd.socket.in'), + 'socket_admin_in': files('virtlockd-admin.socket.in'), + 'socket_extra_in': [ + files('virtlockd.socket.extra.in'), + ], +} + +openrc_init_files += { + 'name': 'virtlockd', + 'in_file': files('virtlockd.init.in'), +} + +if conf.has('WITH_SANLOCK') + virt_helpers += { + 'name': 'libvirt_sanlock_helper', 'sources': [ - lock_daemon_sources, - lock_daemon_generated, - lock_protocol_generated, + sanlock_helper_sources, ], 'include': [ - include_directories('.'), + conf_inc_dir, ], } +endif - virt_daemon_units += { - 'service': 'virtlockd', - 'name': 'locking', - 'service_in': files('virtlockd.service.in'), - 'service_extra_in': [ - files('virtlockd.service.extra.in'), - systemd_service_oomscoreadjust_extra_in, - systemd_service_limitnofile_extra_in, - ], - 'sockets': [ 'main', 'admin' ], - 'socket_in': files('virtlockd.socket.in'), - 'socket_admin_in': files('virtlockd-admin.socket.in'), - 'socket_extra_in': [ - files('virtlockd.socket.extra.in'), - ], - } +virt_aug_files += files('libvirt_lockd.aug') - openrc_init_files += { - 'name': 'virtlockd', - 'in_file': files('virtlockd.init.in'), +if conf.has('WITH_QEMU') + qemu_lockd_conf = configure_file( + input: 'lockd.conf', + output: 'qemu-lockd.conf', + configuration: configmake_conf, + ) + virt_conf_files += qemu_lockd_conf + virt_test_aug_files += { + 'name': 'test_libvirt_lockd.aug', + 'aug': files('test_libvirt_lockd.aug.in'), + 'conf': qemu_lockd_conf, + 'test_name': 'libvirt_lockd', + 'test_srcdir': meson.current_source_dir(), + 'test_builddir': meson.current_build_dir(), } +endif - if conf.has('WITH_SANLOCK') - virt_helpers += { - 'name': 'libvirt_sanlock_helper', - 'sources': [ - sanlock_helper_sources, - ], - 'include': [ - conf_inc_dir, - ], - } - endif +if conf.has('WITH_LIBXL') + libxl_lockd_conf = configure_file( + input: 'lockd.conf', + output: 'libxl-lockd.conf', + configuration: configmake_conf, + ) + virt_conf_files += libxl_lockd_conf +endif - virt_aug_files += files('libvirt_lockd.aug') +if conf.has('WITH_SANLOCK') + virt_aug_files += files('libvirt_sanlock.aug') + virt_test_aug_files += { + 'name': 'test_libvirt_sanlock.aug', + 'aug': files('test_libvirt_sanlock.aug.in'), + 'conf': files('sanlock.conf'), + 'test_name': 'libvirt_sanlock', + 'test_srcdir': meson.current_source_dir(), + 'test_builddir': meson.current_build_dir(), + } if conf.has('WITH_QEMU') - qemu_lockd_conf = configure_file( - input: 'lockd.conf', - output: 'qemu-lockd.conf', + qemu_sanlock_conf = configure_file( + input: 'sanlock.conf', + output: 'qemu-sanlock.conf', configuration: configmake_conf, ) - virt_conf_files += qemu_lockd_conf - virt_test_aug_files += { - 'name': 'test_libvirt_lockd.aug', - 'aug': files('test_libvirt_lockd.aug.in'), - 'conf': qemu_lockd_conf, - 'test_name': 'libvirt_lockd', - 'test_srcdir': meson.current_source_dir(), - 'test_builddir': meson.current_build_dir(), - } + virt_conf_files += qemu_sanlock_conf endif if conf.has('WITH_LIBXL') - libxl_lockd_conf = configure_file( - input: 'lockd.conf', - output: 'libxl-lockd.conf', + libxl_sanlock_conf = configure_file( + input: 'sanlock.conf', + output: 'libxl-sanlock.conf', configuration: configmake_conf, ) - virt_conf_files += libxl_lockd_conf + virt_conf_files += libxl_sanlock_conf endif +endif - if conf.has('WITH_SANLOCK') - virt_aug_files += files('libvirt_sanlock.aug') - virt_test_aug_files += { - 'name': 'test_libvirt_sanlock.aug', - 'aug': files('test_libvirt_sanlock.aug.in'), - 'conf': files('sanlock.conf'), - 'test_name': 'libvirt_sanlock', - 'test_srcdir': meson.current_source_dir(), - 'test_builddir': meson.current_build_dir(), - } +virt_conf_files += files('virtlockd.conf') +virt_aug_files += files('virtlockd.aug') +virt_test_aug_files += { + 'name': 'test_virtlockd.aug', + 'aug': files('test_virtlockd.aug.in'), + 'conf': files('virtlockd.conf'), + 'test_name': 'virtlockd', + 'test_srcdir': meson.current_source_dir(), + 'test_builddir': meson.current_build_dir(), +} - if conf.has('WITH_QEMU') - qemu_sanlock_conf = configure_file( - input: 'sanlock.conf', - output: 'qemu-sanlock.conf', - configuration: configmake_conf, - ) - virt_conf_files += qemu_sanlock_conf - endif - - if conf.has('WITH_LIBXL') - libxl_sanlock_conf = configure_file( - input: 'sanlock.conf', - output: 'libxl-sanlock.conf', - configuration: configmake_conf, - ) - virt_conf_files += libxl_sanlock_conf - endif - endif - - virt_conf_files += files('virtlockd.conf') - virt_aug_files += files('virtlockd.aug') - virt_test_aug_files += { - 'name': 'test_virtlockd.aug', - 'aug': files('test_virtlockd.aug.in'), - 'conf': files('virtlockd.conf'), - 'test_name': 'virtlockd', - 'test_srcdir': meson.current_source_dir(), - 'test_builddir': meson.current_build_dir(), - } +virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'lockd', + localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files', + runstatedir / 'libvirt' / 'lockd', +] +if conf.has('WITH_SANLOCK') virt_install_dirs += [ - localstatedir / 'lib' / 'libvirt' / 'lockd', - localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files', - runstatedir / 'libvirt' / 'lockd', + localstatedir / 'lib' / 'libvirt' / 'sanlock', ] - - if conf.has('WITH_SANLOCK') - virt_install_dirs += [ - localstatedir / 'lib' / 'libvirt' / 'sanlock', - ] - endif endif diff --git a/src/logging/meson.build b/src/logging/meson.build index 67eeacce43..fad3eab497 100644 --- a/src/logging/meson.build +++ b/src/logging/meson.build @@ -57,63 +57,61 @@ else sym_files += 'libvirt_logging.syms' endif -if conf.has('WITH_LIBVIRTD') - log_daemon_generated = custom_target( - 'log_daemon_dispatch_stubs.h', - input: log_protocol, - output: 'log_daemon_dispatch_stubs.h', - command: [ - gendispatch_prog, '--mode=server', - 'virLogManagerProtocol', 'VIR_LOG_MANAGER_PROTOCOL', '@INPUT@', - ], - capture: true, - ) +log_daemon_generated = custom_target( + 'log_daemon_dispatch_stubs.h', + input: log_protocol, + output: 'log_daemon_dispatch_stubs.h', + command: [ + gendispatch_prog, '--mode=server', + 'virLogManagerProtocol', 'VIR_LOG_MANAGER_PROTOCOL', '@INPUT@', + ], + capture: true, +) - virt_daemons += { - 'name': 'virtlogd', - 'sources': [ - log_daemon_sources, - log_daemon_generated, - log_protocol_generated, - ], - 'include': [ - include_directories('.'), - ], - } +virt_daemons += { + 'name': 'virtlogd', + 'sources': [ + log_daemon_sources, + log_daemon_generated, + log_protocol_generated, + ], + 'include': [ + include_directories('.'), + ], +} - virt_conf_files += files('virtlogd.conf') - virt_aug_files += files('virtlogd.aug') - virt_test_aug_files += { - 'name': 'test_virtlogd.aug', - 'aug': files('test_virtlogd.aug.in'), - 'conf': files('virtlogd.conf'), - 'test_name': 'virtlogd', - 'test_srcdir': meson.current_source_dir(), - 'test_builddir': meson.current_build_dir(), - } +virt_conf_files += files('virtlogd.conf') +virt_aug_files += files('virtlogd.aug') +virt_test_aug_files += { + 'name': 'test_virtlogd.aug', + 'aug': files('test_virtlogd.aug.in'), + 'conf': files('virtlogd.conf'), + 'test_name': 'virtlogd', + 'test_srcdir': meson.current_source_dir(), + 'test_builddir': meson.current_build_dir(), +} - virt_daemon_units += { - 'service': 'virtlogd', - 'name': 'logging', - 'service_in': files('virtlogd.service.in'), - 'service_extra_in': [ - files('virtlogd.service.extra.in'), - systemd_service_oomscoreadjust_extra_in, - systemd_service_limitnofile_extra_in, - ], - 'sockets': [ 'main', 'admin' ], - 'socket_in': files('virtlogd.socket.in'), - 'socket_admin_in': files('virtlogd-admin.socket.in'), - 'socket_extra_in': [ - files('virtlogd.socket.extra.in'), - ], - } +virt_daemon_units += { + 'service': 'virtlogd', + 'name': 'logging', + 'service_in': files('virtlogd.service.in'), + 'service_extra_in': [ + files('virtlogd.service.extra.in'), + systemd_service_oomscoreadjust_extra_in, + systemd_service_limitnofile_extra_in, + ], + 'sockets': [ 'main', 'admin' ], + 'socket_in': files('virtlogd.socket.in'), + 'socket_admin_in': files('virtlogd-admin.socket.in'), + 'socket_extra_in': [ + files('virtlogd.socket.extra.in'), + ], +} - openrc_init_files += { - 'name': 'virtlogd', - 'in_file': files('virtlogd.init.in'), - } -endif +openrc_init_files += { + 'name': 'virtlogd', + 'in_file': files('virtlogd.init.in'), +} log_inc_dir = include_directories('.') diff --git a/src/meson.build b/src/meson.build index cab52ce7a3..7d2a4c72de 100644 --- a/src/meson.build +++ b/src/meson.build @@ -811,120 +811,118 @@ foreach data : virt_daemon_confs endforeach -if conf.has('WITH_LIBVIRTD') - # Generate systemd service and socket unit files - if init_script == 'systemd' - install_data( - guest_unit_files, +# Generate systemd service and socket unit files +if init_script == 'systemd' + install_data( + guest_unit_files, + install_dir: unitdir, + ) + + if conf.has('WITH_POLKIT') + sockmode = '0666' + else + sockmode = '0600' + endif + + service_in_default = 'virtd.service.in' + + foreach unit : virt_daemon_units + unit_conf = configuration_data({ + 'runstatedir': runstatedir, + 'sbindir': sbindir, + 'sysconfdir': sysconfdir, + 'initconfdir': initconfdir, + 'localstatedir': localstatedir, + 'name': unit['name'], + 'service': unit['service'], + 'SERVICE': unit['service'].to_upper(), + 'sockprefix': unit.get('sockprefix', unit['service']), + 'sockmode': sockmode, + }) + + service_in = unit.get('service_in', service_in_default) + service_out = '@0@.service'.format(unit['service']) + + service_in = configure_file( + input: [ service_in ] + unit['service_extra_in'], + output: '@0@.in'.format(service_out), + command: [ merge_systemd_units_prog, '@INPUT@' ], + capture: true, + ) + + configure_file( + input: service_in, + output: service_out, + configuration: unit_conf, + install: true, install_dir: unitdir, ) - if conf.has('WITH_POLKIT') - sockmode = '0666' - else - sockmode = '0600' - endif - - service_in_default = 'virtd.service.in' - - foreach unit : virt_daemon_units - unit_conf = configuration_data({ - 'runstatedir': runstatedir, - 'sbindir': sbindir, - 'sysconfdir': sysconfdir, - 'initconfdir': initconfdir, - 'localstatedir': localstatedir, - 'name': unit['name'], - 'service': unit['service'], - 'SERVICE': unit['service'].to_upper(), - 'sockprefix': unit.get('sockprefix', unit['service']), - 'sockmode': sockmode, - }) - - service_in = unit.get('service_in', service_in_default) - service_out = '@0@.service'.format(unit['service']) - - service_in = configure_file( - input: [ service_in ] + unit['service_extra_in'], - output: '@0@.in'.format(service_out), + foreach socket : unit.get('sockets', [ 'main', 'ro', 'admin' ]) + if socket == 'main' + socket_in_default = 'virtd.socket.in' + socket_in = unit.get('socket_in', socket_in_default) + socket_out = '@0@.socket'.format(unit['service']) + else + socket_in_default = 'virtd-@0@.socket.in'.format(socket) + socket_in = unit.get('socket_@0@_in'.format(socket), socket_in_default) + socket_out = '@0@-@1@.socket'.format(unit['service'], socket) + endif + + socket_in = configure_file( + input: [ socket_in ] + unit['socket_extra_in'], + output: '@0@.in'.format(socket_out), command: [ merge_systemd_units_prog, '@INPUT@' ], capture: true, ) configure_file( - input: service_in, - output: service_out, + input: socket_in, + output: socket_out, configuration: unit_conf, install: true, install_dir: unitdir, ) - - foreach socket : unit.get('sockets', [ 'main', 'ro', 'admin' ]) - if socket == 'main' - socket_in_default = 'virtd.socket.in' - socket_in = unit.get('socket_in', socket_in_default) - socket_out = '@0@.socket'.format(unit['service']) - else - socket_in_default = 'virtd-@0@.socket.in'.format(socket) - socket_in = unit.get('socket_@0@_in'.format(socket), socket_in_default) - socket_out = '@0@-@1@.socket'.format(unit['service'], socket) - endif - - socket_in = configure_file( - input: [ socket_in ] + unit['socket_extra_in'], - output: '@0@.in'.format(socket_out), - command: [ merge_systemd_units_prog, '@INPUT@' ], - capture: true, - ) - - configure_file( - input: socket_in, - output: socket_out, - configuration: unit_conf, - install: true, - install_dir: unitdir, - ) - endforeach endforeach - endif + endforeach +endif - # Generate openrc init files - if init_script == 'openrc' - foreach init : openrc_init_files - if conf.has('WITH_FIREWALLD') - need_firewalld = 'need firewalld' - else - need_firewalld = '' - endif +# Generate openrc init files +if init_script == 'openrc' + foreach init : openrc_init_files + if conf.has('WITH_FIREWALLD') + need_firewalld = 'need firewalld' + else + need_firewalld = '' + endif - init_conf = configuration_data({ - 'sbindir': sbindir, - 'runstatedir': runstatedir, - 'NEED_FIREWALLD': need_firewalld, - }) + init_conf = configuration_data({ + 'sbindir': sbindir, + 'runstatedir': runstatedir, + 'NEED_FIREWALLD': need_firewalld, + }) - init_file = configure_file( - input: init['in_file'], - output: '@0@.init'.format(init['name']), - configuration: init_conf, - ) + init_file = configure_file( + input: init['in_file'], + output: '@0@.init'.format(init['name']), + configuration: init_conf, + ) + install_data( + init_file, + install_dir: sysconfdir / 'init.d', + install_mode: 'rwxr-xr-x', + rename: [ init['name'] ], + ) + + if init.has_key('confd') install_data( - init_file, - install_dir: sysconfdir / 'init.d', - install_mode: 'rwxr-xr-x', + init['confd'], + install_dir: sysconfdir / 'conf.d', rename: [ init['name'] ], ) - - if init.has_key('confd') - install_data( - init['confd'], - install_dir: sysconfdir / 'conf.d', - rename: [ init['name'] ], - ) - endif - endforeach - endif + endif + endforeach endif if conf.has('WITH_DTRACE_PROBES') @@ -952,14 +950,12 @@ virt_install_dirs += [ localstatedir / 'lib' / 'libvirt' / 'boot', ] -if conf.has('WITH_LIBVIRTD') - virt_install_dirs += [ - connection_driver_install_dir, - storage_backend_install_dir, - storage_file_install_dir, - lock_driver_install_dir, - ] -endif +virt_install_dirs += [ + connection_driver_install_dir, + storage_backend_install_dir, + storage_file_install_dir, + lock_driver_install_dir, +] meson.add_install_script( meson_python_prog.full_path(), python3_prog.full_path(), meson_install_dirs_prog.full_path(), diff --git a/src/remote/meson.build b/src/remote/meson.build index e503263266..e0faa6d07d 100644 --- a/src/remote/meson.build +++ b/src/remote/meson.build @@ -181,9 +181,9 @@ if conf.has('WITH_REMOTE') libvirt_libs += remote_driver_lib + guest_unit_files += files('virt-guest-shutdown.target') + if conf.has('WITH_LIBVIRTD') - guest_unit_files += files('virt-guest-shutdown.target') - virt_daemons += { 'name': 'libvirtd', 'c_args': [ @@ -226,63 +226,6 @@ if conf.has('WITH_REMOTE') 'confd': files('libvirtd.confd'), } - virt_daemons += { - 'name': 'virtproxyd', - 'c_args': [ - '-DSOCK_PREFIX="libvirt"', - '-DDAEMON_NAME="virtproxyd"', - '-DWITH_IP', - '-DVIRTPROXYD', - ], - } - - virt_daemon_confs += { - 'name': 'virtproxyd', - 'with_ip': true, - } - - virt_daemon_units += { - 'service': 'virtproxyd', - 'name': 'proxy', - 'service_extra_in': [ - files('virtproxyd.service.extra.in'), - ], - 'sockprefix': 'libvirt', - 'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ], - 'socket_extra_in': [ - files('virtproxyd.socket.extra.in'), - ], - } - - openrc_init_files += { - 'name': 'virtproxyd', - 'in_file': files('virtproxyd.init.in'), - 'confd': files('virtproxyd.confd'), - } - - virt_install_dirs += [ - localstatedir / 'log' / 'libvirt', - runstatedir / 'libvirt', - runstatedir / 'libvirt' / 'common', - ] - - logrotate_conf = configuration_data({ - 'localstatedir': localstatedir, - }) - - foreach name : logrotate_files - log_file = configure_file( - input: '@0@.logrotate.in'.format(name), - output: '@0@.logrotate'.format(name), - configuration: logrotate_conf, - ) - install_data( - log_file, - install_dir: sysconfdir / 'logrotate.d', - rename: [ name ], - ) - endforeach - if conf.has('WITH_SYSCTL') # Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on # /usr/lib/sysctl.d/ even when libdir is /usr/lib64 @@ -292,39 +235,96 @@ if conf.has('WITH_REMOTE') rename: [ '60-libvirtd.conf' ], ) endif + endif + + virt_daemons += { + 'name': 'virtproxyd', + 'c_args': [ + '-DSOCK_PREFIX="libvirt"', + '-DDAEMON_NAME="virtproxyd"', + '-DWITH_IP', + '-DVIRTPROXYD', + ], + } + + virt_daemon_confs += { + 'name': 'virtproxyd', + 'with_ip': true, + } + + virt_daemon_units += { + 'service': 'virtproxyd', + 'name': 'proxy', + 'service_extra_in': [ + files('virtproxyd.service.extra.in'), + ], + 'sockprefix': 'libvirt', + 'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ], + 'socket_extra_in': [ + files('virtproxyd.socket.extra.in'), + ], + } + + openrc_init_files += { + 'name': 'virtproxyd', + 'in_file': files('virtproxyd.init.in'), + 'confd': files('virtproxyd.confd'), + } + + virt_install_dirs += [ + localstatedir / 'log' / 'libvirt', + runstatedir / 'libvirt', + runstatedir / 'libvirt' / 'common', + ] + + logrotate_conf = configuration_data({ + 'localstatedir': localstatedir, + }) - if conf.has('WITH_POLKIT') - i18n.merge_file( - input: 'libvirtd.policy.in', - output: 'org.libvirt.unix.policy', - po_dir: po_dir, - data_dirs: [po_dir], - install: true, - install_dir: polkitactionsdir, - ) - - install_data( - 'libvirtd.rules', - install_dir: polkitrulesdir, - rename: [ '50-libvirt.rules' ], - ) - endif - - # Install the sysuser config for the daemon polkit rules + foreach name : logrotate_files + log_file = configure_file( + input: '@0@.logrotate.in'.format(name), + output: '@0@.logrotate'.format(name), + configuration: logrotate_conf, + ) install_data( - 'libvirt.sysusers.conf', - install_dir: sysusersdir, - rename: [ 'libvirt.conf' ], + log_file, + install_dir: sysconfdir / 'logrotate.d', + rename: [ name ], + ) + endforeach + + if conf.has('WITH_POLKIT') + i18n.merge_file( + input: 'libvirtd.policy.in', + output: 'org.libvirt.unix.policy', + po_dir: po_dir, + data_dirs: [po_dir], + install: true, + install_dir: polkitactionsdir, ) - virt_helpers += { - 'name': 'virt-ssh-helper', - 'sources': [ - virt_ssh_helper_sources - ], - 'install_dir': bindir, - } + install_data( + 'libvirtd.rules', + install_dir: polkitrulesdir, + rename: [ '50-libvirt.rules' ], + ) endif + + # Install the sysuser config for the daemon polkit rules + install_data( + 'libvirt.sysusers.conf', + install_dir: sysusersdir, + rename: [ 'libvirt.conf' ], + ) + + virt_helpers += { + 'name': 'virt-ssh-helper', + 'sources': [ + virt_ssh_helper_sources + ], + 'install_dir': bindir, + } endif if conf.has('WITH_REMOTE') diff --git a/src/security/meson.build b/src/security/meson.build index 6230b34aa4..aaeb1ec363 100644 --- a/src/security/meson.build +++ b/src/security/meson.build @@ -36,7 +36,7 @@ security_driver_lib = static_library( libvirt_libs += security_driver_lib -if conf.has('WITH_LIBVIRTD') and conf.has('WITH_APPARMOR') +if conf.has('WITH_APPARMOR') virt_helpers += { 'name': 'virt-aa-helper', 'sources': [ diff --git a/src/util/meson.build b/src/util/meson.build index 9fb0aa0fe7..a685d72ebd 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -210,18 +210,16 @@ virt_util_lib = static_library( libvirt_libs += virt_util_lib -if conf.has('WITH_LIBVIRTD') - virt_helpers += { - 'name': 'libvirt_iohelper', - 'sources': [ - files(io_helper_sources), - dtrace_gen_headers, - ], - 'deps': [ - acl_dep, - libutil_dep, - ], - } -endif +virt_helpers += { + 'name': 'libvirt_iohelper', + 'sources': [ + files(io_helper_sources), + dtrace_gen_headers, + ], + 'deps': [ + acl_dep, + libutil_dep, + ], +} util_inc_dir = include_directories('.') diff --git a/tools/meson.build b/tools/meson.build index a099148d3c..568947d308 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -334,25 +334,23 @@ if conf.has('WITH_QEMU') install_dir: bindir) endif -if conf.has('WITH_LIBVIRTD') +configure_file( + input: 'libvirt-guests.sh.in', + output: '@BASENAME@', + configuration: tools_conf, + install: true, + install_dir: libexecdir, + install_mode: 'rwxr-xr-x', +) + +if init_script == 'systemd' configure_file( - input: 'libvirt-guests.sh.in', + input: 'libvirt-guests.service.in', output: '@BASENAME@', configuration: tools_conf, install: true, - install_dir: libexecdir, - install_mode: 'rwxr-xr-x', + install_dir: unitdir, ) - - if init_script == 'systemd' - configure_file( - input: 'libvirt-guests.service.in', - output: '@BASENAME@', - configuration: tools_conf, - install: true, - install_dir: unitdir, - ) - endif endif if conf.has('WITH_QEMU') -- 2.51.0