From: Matthias Maier Date: Sat, 11 Apr 2020 01:45:30 +0000 (-0500) Subject: app-emulation/libvirt: update openrc init scripts X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ca0a61eed33d17d0bd434ea5ad5c7bf2f891621c;p=gentoo.git app-emulation/libvirt: update openrc init scripts Upstream changes between 6.1.0 and 6.2.0 on pidfile handling break our openrc init script due to a race condition. Work around this issue by not using the "-d" option (keeping the daemon in foreground) and let start-stop-daemon do double-forking ("-b" option). Closes: https://bugs.gentoo.org/716800 Package-Manager: Portage-2.3.98, Repoman-2.3.22 Signed-off-by: Matthias Maier --- diff --git a/app-emulation/libvirt/files/libvirtd.init-r19 b/app-emulation/libvirt/files/libvirtd.init-r19 new file mode 100644 index 000000000000..60dad6a791dc --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.init-r19 @@ -0,0 +1,33 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="Virtual Machine Management daemon (libvirt)" + +LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"} +LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"} + +command="/usr/sbin/libvirtd" +command_args="${LIBVIRTD_OPTS}" +start_stop_daemon_args="-b --env KRB5_KTNAME=/etc/libvirt/krb5.tab" +pidfile="/run/libvirtd.pid" +retry="${LIBVIRTD_TERMTIMEOUT}" + +depend() { + need virtlogd + use ceph dbus iscsid virtlockd + after cgconfig corosync ebtables iptables ip6tables nfs nfsmount ntp-client ntpdportmap rpc.statd sanlock xenconsoled + USE_FLAG_FIREWALLD +} + +start_pre() { + # Test configuration directories in /etc/libvirt/ to be either not + # present or a directory, i.e. not a regular file, bug #532892 + + checkpath --directory /etc/libvirt/lxc || return 1 + checkpath --directory /etc/libvirt/nwfilter || return 1 + [ -L /etc/libvirt/qemu ] || + checkpath --directory /etc/libvirt/qemu || return 1 + [ -L /etc/libvirt/storage ] || + checkpath --directory /etc/libvirt/storage || return 1 +} diff --git a/app-emulation/libvirt/files/virtlockd.init-r2 b/app-emulation/libvirt/files/virtlockd.init-r2 new file mode 100644 index 000000000000..385dc1e62319 --- /dev/null +++ b/app-emulation/libvirt/files/virtlockd.init-r2 @@ -0,0 +1,23 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="libvirt virtual machine lock manager" +command="/usr/sbin/virtlockd" +start_stop_daemon_args="-b" +pidfile="/run/virtlockd.pid" + +extra_started_commands="reload" +description_reload="re-exec the daemon, while maintaining locks and clients" + + +depend() { + after ntp-client ntpd nfs nfsmount corosync +} + +reload() { + ebegin "re-exec() virtlockd" + + start-stop-daemon --signal SIGUSR1 \ + --exec "${command}" --pidfile "${pidfile}" +} diff --git a/app-emulation/libvirt/files/virtlogd.init-r2 b/app-emulation/libvirt/files/virtlogd.init-r2 new file mode 100644 index 000000000000..442dcb8de48c --- /dev/null +++ b/app-emulation/libvirt/files/virtlogd.init-r2 @@ -0,0 +1,23 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="libvirt virtual machine logging manager" +command="/usr/sbin/virtlogd" +start_stop_daemon_args="-b" +pidfile="/run/virtlogd.pid" + +extra_started_commands="reload" +description_reload="re-exec the daemon, while maintaining open connections" + + +depend() { + after ntp-client ntpd nfs nfsmount corosync +} + +reload() { + ebegin "re-exec() virtlogd" + + start-stop-daemon --signal SIGUSR1 \ + --exec "${command}" --pidfile "${pidfile}" +} diff --git a/app-emulation/libvirt/libvirt-6.2.0-r1.ebuild b/app-emulation/libvirt/libvirt-6.2.0-r2.ebuild similarity index 98% rename from app-emulation/libvirt/libvirt-6.2.0-r1.ebuild rename to app-emulation/libvirt/libvirt-6.2.0-r2.ebuild index a387149a3641..8079bd8549bb 100644 --- a/app-emulation/libvirt/libvirt-6.2.0-r1.ebuild +++ b/app-emulation/libvirt/libvirt-6.2.0-r2.ebuild @@ -219,7 +219,7 @@ src_prepare() { default # Tweak the init script: - cp "${FILESDIR}/libvirtd.init-r18" "${S}/libvirtd.init" || die + cp "${FILESDIR}/libvirtd.init-r19" "${S}/libvirtd.init" || die sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \ -i "${S}/libvirtd.init" || die "sed failed" @@ -328,8 +328,8 @@ my_src_install() { newinitd "${S}/libvirtd.init" libvirtd newinitd "${FILESDIR}/libvirt-guests.init-r4" libvirt-guests - newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd - newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd + newinitd "${FILESDIR}/virtlockd.init-r2" virtlockd + newinitd "${FILESDIR}/virtlogd.init-r2" virtlogd newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests diff --git a/app-emulation/libvirt/libvirt-9999.ebuild b/app-emulation/libvirt/libvirt-9999.ebuild index 9d8951755786..0f0e3da1713f 100644 --- a/app-emulation/libvirt/libvirt-9999.ebuild +++ b/app-emulation/libvirt/libvirt-9999.ebuild @@ -218,7 +218,7 @@ src_prepare() { default # Tweak the init script: - cp "${FILESDIR}/libvirtd.init-r18" "${S}/libvirtd.init" || die + cp "${FILESDIR}/libvirtd.init-r19" "${S}/libvirtd.init" || die sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \ -i "${S}/libvirtd.init" || die "sed failed" @@ -327,8 +327,8 @@ my_src_install() { newinitd "${S}/libvirtd.init" libvirtd newinitd "${FILESDIR}/libvirt-guests.init-r4" libvirt-guests - newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd - newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd + newinitd "${FILESDIR}/virtlockd.init-r2" virtlockd + newinitd "${FILESDIR}/virtlogd.init-r2" virtlogd newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests