[PATCH 0/3] build: Add option to disable building monolithic libvirtd
This is a V1 of an RFC series I posted earlier https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/thread/D22CJ... As Daniel suggested, it leaves the semantics of existing 'driver_libvirtd' option unchanged and introduces a new 'libvirtd' option. Michal's comments also incorporated into V1. Patch 1 is new to the series. I suppose it can be pushed independently, unless I'm missing some meson magic. Jim Fehlig (3): build: Remove unused libvirtd_socket_unit_files build: Add option to disable building libvirtd spec: Add option to enable/disable monolithic libvirtd docs/manpages/meson.build | 2 +- libvirt.spec.in | 22 +++++++- meson.build | 10 ++++ meson_options.txt | 2 + src/remote/meson.build | 86 ++++++++++++++----------------- src/security/apparmor/meson.build | 5 +- tests/meson.build | 2 +- 7 files changed, 79 insertions(+), 50 deletions(-) -- 2.51.0
From: Jim Fehlig <jfehlig@suse.com> libvirtd_socket_unit_files is declared in src/remote/meson.build but never used. Remove it. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- src/remote/meson.build | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/remote/meson.build b/src/remote/meson.build index dfd61df62f..c9d8e921b2 100644 --- a/src/remote/meson.build +++ b/src/remote/meson.build @@ -130,14 +130,6 @@ foreach name : libvirt_conf_files set_variable(name['virtd'].underscorify(), tmp) endforeach -libvirtd_socket_unit_files = [ - 'libvirtd.socket', - 'libvirtd-ro.socket', - 'libvirtd-admin.socket', - 'libvirtd-tcp.socket', - 'libvirtd-tls.socket', -] - logrotate_files = [ 'libvirtd.qemu', 'libvirtd.lxc', -- 2.51.0
From: Jim Fehlig <jfehlig@suse.com> Add an option to disable building the monolithic libvirtd, e.g. meson configure -Dlibvirtd=disabled build-dir There's an existing option called driver_libvirtd, but it's intended to disable building not only libvirtd, but all stateful, daemon-based drivers. driver_libvirtd is also used by various libvirt-ci projects to get a minimalistic build. In short, it can't be used to disable building only the monolithic daemon. Introduce a new 'libvirtd' option to do that. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- docs/manpages/meson.build | 2 +- meson.build | 10 ++++ meson_options.txt | 2 + src/remote/meson.build | 78 ++++++++++++++++--------------- src/security/apparmor/meson.build | 5 +- tests/meson.build | 2 +- 6 files changed, 58 insertions(+), 41 deletions(-) diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build index 6504e68a71..ee686bfd1b 100644 --- a/docs/manpages/meson.build +++ b/docs/manpages/meson.build @@ -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') }, diff --git a/meson.build b/meson.build index 8a49d07f11..9d95127d80 100644 --- a/meson.build +++ b/meson.build @@ -1483,6 +1483,15 @@ if udev_dep.found() and not pciaccess_dep.found() error('You must install the pciaccess module to build with udev') endif +# build daemon +if not get_option('libvirtd').disabled() + if not conf.has('WITH_REMOTE') + if get_option('libvirtd').enabled() + error('remote driver is required for libvirtd daemon') + endif + endif + conf.set('WITH_MONOLITHIC_LIBVIRTD', 1) +endif # build driver options @@ -2260,6 +2269,7 @@ driver_summary = { 'VBox': conf.has('WITH_VBOX'), 'VMware': conf.has('WITH_VMWARE'), 'vz': conf.has('WITH_VZ'), + 'Mono libvirtd': conf.has('WITH_MONOLITHIC_LIBVIRTD'), } summary(driver_summary, section: 'Drivers', bool_yn: true) diff --git a/meson_options.txt b/meson_options.txt index e12ace4e11..8592880b7b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/src/remote/meson.build b/src/remote/meson.build index c9d8e921b2..b02c7193ff 100644 --- a/src/remote/meson.build +++ b/src/remote/meson.build @@ -176,47 +176,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', diff --git a/src/security/apparmor/meson.build b/src/security/apparmor/meson.build index 09d9fac02c..7585fb7100 100644 --- a/src/security/apparmor/meson.build +++ b/src/security/apparmor/meson.build @@ -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, diff --git a/tests/meson.build b/tests/meson.build index 83aa0104bb..42223a8e73 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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' ], -- 2.51.0
From: Jim Fehlig <jfehlig@suse.com> Make use of build option to enable/disable building the monolithic libvirtd Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- libvirt.spec.in | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 2fddfcd606..69acb3721e 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -31,7 +31,10 @@ %define arches_numad %{arches_x86} %{power64} aarch64 %define arches_ch x86_64 aarch64 -# The hypervisor drivers that run in libvirtd +# The monolithic libvirtd +%define with_libvirtd 0%{!?_without_libvirtd:1} + +# The hypervisor drivers that run in monolithic libvirtd, or a modular daemon %define with_lxc 0%{!?_without_lxc:1} %define with_libxl 0%{!?_without_libxl:1} %define with_vbox 0%{!?_without_vbox:1} @@ -304,7 +307,11 @@ URL: https://libvirt.org/ %endif Source: https://download.libvirt.org/%{?mainturl}libvirt-%{version}.tar.xz +%if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} +%else +Obsoletes: libvirt-daemon < %(version)-%(release) +%endif Requires: libvirt-daemon-config-network = %{version}-%{release} Requires: libvirt-daemon-config-nwfilter = %{version}-%{release} %if %{with_libxl} @@ -1181,6 +1188,12 @@ echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}" exit 1 %endif +%if %{with_libvirtd} + %define arg_libvirtd -Dlibvirtd=enabled +%else + %define arg_libvirtd -Dlibvirtd=disabled +%endif + %if %{with_qemu} %define arg_qemu -Ddriver_qemu=enabled %else @@ -1364,6 +1377,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec) -Dsasl=enabled \ -Dpolkit=enabled \ -Ddriver_libvirtd=enabled \ + %{?arg_libvirtd} \ -Ddriver_remote=enabled \ -Ddriver_test=enabled \ %{?arg_esx} \ @@ -1542,6 +1556,10 @@ cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \ # libvirt saves these files with mode 600 chmod 600 $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml + %if ! %{with_libvirtd} +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd + %endif + %if ! %{with_qemu} rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug @@ -2075,6 +2093,7 @@ exit 0 %doc AUTHORS.rst NEWS.rst README.rst %doc libvirt-docs/* + %if %{with_libvirtd} %files daemon %{_unitdir}/libvirtd.service %{_unitdir}/libvirtd.socket @@ -2091,6 +2110,7 @@ exit 0 %{_datadir}/augeas/lenses/tests/test_libvirtd.aug %attr(0755, root, root) %{_sbindir}/libvirtd %{_mandir}/man8/libvirtd.8* + %endif %files daemon-common %{_unitdir}/virt-guest-shutdown.target -- 2.51.0
participants (1)
-
Jim Fehlig