From df676b2d47b6a4f1566473e2162cd38b681805bffbd406f6cb4be7087611a332 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 7 Jun 2023 23:17:23 +0000 Subject: [PATCH] - apparmor: Add support for local profile customizations spec: Replace /etc/apparmor.d/ on package upgrade bsc#1211472 - supportconfig: Modular daemon improvements OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=985 --- _service | 1 + libvirt-9.4.0.tar.xz | 4 ++-- libvirt-supportconfig | 36 +++++++++++------------------------- libvirt.changes | 8 ++++++++ libvirt.spec | 37 ++++++++++++++++++++++++++++--------- 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/_service b/_service index df492d1..0e528cf 100644 --- a/_service +++ b/_service @@ -5,6 +5,7 @@ factory libvirt.spec README.packaging.txt + libvirt-supportconfig @PARENT_TAG@ [v]?([^-+a-z]+)(.*) \1 diff --git a/libvirt-9.4.0.tar.xz b/libvirt-9.4.0.tar.xz index 5a62b36..305e8ef 100644 --- a/libvirt-9.4.0.tar.xz +++ b/libvirt-9.4.0.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5dfa4a68bb0f93a11c9218a1f4dae32f29fbb4d2071c0feb3abc6a1a4bec2427 -size 9590948 +oid sha256:2ae33efdacd3fa6f69222fe41bf90d1ee339b8cb9efa416d5a5335e3227b219a +size 9592144 diff --git a/libvirt-supportconfig b/libvirt-supportconfig index f0ca7c4..0ce12b5 100644 --- a/libvirt-supportconfig +++ b/libvirt-supportconfig @@ -8,11 +8,12 @@ RCFILE="/usr/lib/supportconfig/resources/scplugin.rc" -LIBVIRTD_CONF_FILES="$(find -L /etc/libvirt/*.conf -type f | sort)" +# conf files for all daemons reside in /etc/libvirt/. VM conf files +# and log files reside in hypervisor-specific locations. +DAEMON_CONF_FILES="$(find -L /etc/libvirt/*.conf -type f 2>/dev/null | sort)" PERSISTENT_VM_CONF_FILES="" ACTIVE_VM_CONF_FILES="" -LIBVIRTD_LOG_FILES="$(find -L /var/log/libvirt/*.log -type f | sort)" - +DAEMON_LOG_FILES="" if [ -s $RCFILE ]; then if ! source $RCFILE; then @@ -55,27 +56,21 @@ rpm_verify() { if rpm_installed libvirt-daemon-driver-libxl; then test -d /etc/libvirt/libxl && PERSISTENT_VM_CONF_FILES="$PERSISTENT_VM_CONF_FILES $(find -L /etc/libvirt/libxl/ -type f | sort)" test -d /run/libvirt/libxl && ACTIVE_VM_CONF_FILES="$ACTIVE_VM_CONF_FILES $(find -L /run/libvirt/libxl/ -type f | sort)" - test -d /var/log/libvirt/libxl && LIBVIRTD_LOG_FILES="$LIBVIRTD_LOG_FILES $(find -L /var/log/libvirt/libxl/ -type f | sort)" + test -d /var/log/libvirt/libxl && DAEMON_LOG_FILES="$DAEMON_LOG_FILES $(find -L /var/log/libvirt/libxl/ -type f | sort)" fi if rpm_installed libvirt-daemon-driver-qemu; then test -d /etc/libvirt/qemu && PERSISTENT_VM_CONF_FILES="$PERSISTENT_VM_CONF_FILES $(find -L /etc/libvirt/qemu/ -type f | sort)" test -d /run/libvirt/qemu && ACTIVE_VM_CONF_FILES="$ACTIVE_VM_CONF_FILES $(find -L /run/libvirt/qemu/ -type f | sort)" - test -d /var/log/libvirt/qemu && LIBVIRTD_LOG_FILES="$LIBVIRTD_LOG_FILES $(find -L /var/log/libvirt/qemu/ -type f | sort)" + test -d /var/log/libvirt/qemu && DAEMON_LOG_FILES="$DAEMON_LOG_FILES $(find -L /var/log/libvirt/qemu/ -type f | sort)" fi -if rpm_installed libvirt-daemon-driver-lxc; then - test -d /etc/libvirt/lxc && PERSISTENT_VM_CONF_FILES="$PERSISTENT_VM_CONF_FILES $(find -L /etc/libvirt/lxc/ -type f | sort)" - test -d /run/libvirt/lxc && ACTIVE_VM_CONF_FILES="$ACTIVE_VM_CONF_FILES $(find -L /run/libvirt/lxc/ -type f | sort)" - test -d /var/log/libvirt/lxc && LIBVIRTD_LOG_FILES="$LIBVIRTD_LOG_FILES $(find -L /var/log/libvirt/lxc/ -type f | sort)" +if rpm_installed libvirt-daemon; then + DAEMON_LOG_FILES="$DAEMON_LOG_FILES $(find -L /var/log/libvirt/*.log -type f 2>/dev/null | sort)" fi -if ! rpm_verify libvirt-daemon; then - echo "Skipped" - exit 0 -fi +if rpm_installed libvirt-client && virsh capabilities > /dev/null 2>&1; then -if systemctl is-active --quiet libvirtd.service; then plugin_command "virsh version" plugin_command "virsh capabilities" plugin_command "virsh domcapabilities" @@ -102,15 +97,6 @@ if systemctl is-active --quiet libvirtd.service; then plugin_command "virsh snapshot-list $DOM" echo done - # for LXC domains we have to explicitly specify the URI - if rpm_installed libvirt-daemon-driver-lxc; then - for DOM in $(virsh -c lxc:/// list --name --all); do - plugin_command "virsh -c lxc:/// dumpxml $DOM" - plugin_command "virsh -c lxc:/// dominfo $DOM" - echo - done - fi - # dump active networks, interfaces and storage pools plugin_command "virsh net-list" plugin_command "virsh iface-list" @@ -118,7 +104,7 @@ if systemctl is-active --quiet libvirtd.service; then fi # dump libvirtd-related conf files -pconf_files "$LIBVIRTD_CONF_FILES" +pconf_files "$DAEMON_CONF_FILES" # dump persistent VM-related conf files pconf_files "$PERSISTENT_VM_CONF_FILES" @@ -131,6 +117,6 @@ test -d /etc/libvirt/hooks && FILES="$(find -L /etc/libvirt/hooks/ -type f | sor pconf_files "$FILES" # dump all log files -plog_files 0 "$LIBVIRTD_LOG_FILES" +plog_files 0 "$DAEMON_LOG_FILES" echo "Done" diff --git a/libvirt.changes b/libvirt.changes index d36a867..6ea7b62 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Jun 7 22:21:45 UTC 2023 - James Fehlig + +- apparmor: Add support for local profile customizations + spec: Replace /etc/apparmor.d/ on package upgrade + bsc#1211472 +- supportconfig: Modular daemon improvements + ------------------------------------------------------------------- Fri Jun 2 16:26:30 UTC 2023 - James Fehlig diff --git a/libvirt.spec b/libvirt.spec index 3e9ed81..ddfb1f6 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -813,7 +813,7 @@ Requires: %{name}-daemon-driver-network = %{version}-%{release} libvirt plugin for NSS for translating domain names into IP addresses. %prep -%autosetup +%autosetup -p1 %build %if %{with_qemu} @@ -1079,6 +1079,7 @@ rm -f %{buildroot}/%{logrotate_dir}/libvirtd.lxc %if ! %{with_qemu} rm -f %{buildroot}/%{_sysconfdir}/%{name}/qemu.conf rm -f %{buildroot}/%{_sysconfdir}/apparmor.d/usr.sbin.virtqemud +rm -f %{buildroot}/%{_sysconfdir}/apparmor.d/local/usr.sbin.virtqemud rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirtd_qemu.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug rm -f %{buildroot}/%{logrotate_dir}/libvirtd.qemu @@ -1086,6 +1087,7 @@ rm -f %{buildroot}/%{logrotate_dir}/libvirtd.qemu %if ! %{with_libxl} rm -f %{buildroot}/%{_sysconfdir}/%{name}/libxl.conf rm -f %{buildroot}/%{_sysconfdir}/apparmor.d/usr.sbin.virtxend +rm -f %{buildroot}/%{_sysconfdir}/apparmor.d/local/usr.sbin.virtxend rm -f %{buildroot}/%{logrotate_dir}/libvirtd.libxl rm -f %{buildroot}/%{_datadir}/augeas/lenses/libvirtd_libxl.aug rm -f %{buildroot}/%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug @@ -1415,6 +1417,9 @@ fi %libvirt_logrotate_pre libvirtd.qemu %post daemon-driver-qemu +%if %{with_apparmor} +%apparmor_reload /etc/apparmor.d/usr.sbin.virtqemud +%endif %if %{with_modular_daemons} %libvirt_daemon_systemd_post virtqemud %endif @@ -1455,6 +1460,9 @@ fi %libvirt_logrotate_pre libvirtd.libxl %post daemon-driver-libxl +%if %{with_apparmor} +%apparmor_reload /etc/apparmor.d/usr.sbin.virtxend +%endif %if %{with_modular_daemons} %libvirt_daemon_systemd_post virtxend %endif @@ -1490,6 +1498,10 @@ fi %{_unitdir}/libvirtd-tls.socket %{_sbindir}/rclibvirtd %config(noreplace) %{_sysconfdir}/%{name}/libvirtd.conf +%if %{with_apparmor} +%config %{_sysconfdir}/apparmor.d/usr.sbin.libvirtd +%config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.sbin.libvirtd +%endif %{logrotate_prefix} %{logrotate_dir}/libvirtd %dir %{_datadir}/augeas/ %dir %{_datadir}/augeas/lenses/ @@ -1533,12 +1545,7 @@ fi %dir %{_sysconfdir}/apparmor.d/abstractions/ %dir %{_sysconfdir}/apparmor.d/%{name}/ %dir %{_sysconfdir}/apparmor.d/local/ -%config(noreplace) %{_sysconfdir}/apparmor.d/usr.sbin.libvirtd -%config(noreplace) %{_sysconfdir}/apparmor.d/usr.lib.libvirt.virt-aa-helper -%config(noreplace) %{_sysconfdir}/apparmor.d/abstractions/libvirt-qemu -%config(noreplace) %{_sysconfdir}/apparmor.d/abstractions/libvirt-lxc -%config(noreplace) %{_sysconfdir}/apparmor.d/%{name}/TEMPLATE.lxc -%config(noreplace) %{_sysconfdir}/apparmor.d/%{name}/TEMPLATE.qemu +%config %{_sysconfdir}/apparmor.d/usr.lib.libvirt.virt-aa-helper %config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.lib.libvirt.virt-aa-helper %{_libexecdir}/virt-aa-helper %endif @@ -1747,7 +1754,12 @@ fi %files daemon-driver-qemu %config(noreplace) %{_sysconfdir}/%{name}/virtqemud.conf -%config(noreplace) %{_sysconfdir}/apparmor.d/usr.sbin.virtqemud +%if %{with_apparmor} +%config %{_sysconfdir}/apparmor.d/usr.sbin.virtqemud +%config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.sbin.virtqemud +%config %{_sysconfdir}/apparmor.d/abstractions/libvirt-qemu +%config %{_sysconfdir}/apparmor.d/%{name}/TEMPLATE.qemu +%endif %config(noreplace) %{_prefix}/lib/sysctl.d/60-qemu-postcopy-migration.conf %{_datadir}/augeas/lenses/virtqemud.aug %{_datadir}/augeas/lenses/tests/test_virtqemud.aug @@ -1781,6 +1793,10 @@ fi %files daemon-driver-lxc %config(noreplace) %{_sysconfdir}/%{name}/virtlxcd.conf +%if %{with_apparmor} +%config %{_sysconfdir}/apparmor.d/abstractions/libvirt-lxc +%config %{_sysconfdir}/apparmor.d/%{name}/TEMPLATE.lxc +%endif %{_datadir}/augeas/lenses/virtlxcd.aug %{_datadir}/augeas/lenses/tests/test_virtlxcd.aug %{_unitdir}/virtlxcd.service @@ -1809,7 +1825,10 @@ fi %files daemon-driver-libxl %config(noreplace) %{_sysconfdir}/%{name}/virtxend.conf -%config(noreplace) %{_sysconfdir}/apparmor.d/usr.sbin.virtxend +%if %{with_apparmor} +%config %{_sysconfdir}/apparmor.d/usr.sbin.virtxend +%config(noreplace) %{_sysconfdir}/apparmor.d/local/usr.sbin.virtxend +%endif %{_datadir}/augeas/lenses/virtxend.aug %{_datadir}/augeas/lenses/tests/test_virtxend.aug %{_unitdir}/virtxend.service