[libvirt] [PATCH 6/6] spec: Drop overlapping triggers

Jiri Denemark posted 6 patches 7 years, 2 months ago
[libvirt] [PATCH 6/6] spec: Drop overlapping triggers
Posted by Jiri Denemark 7 years, 2 months ago
The postun trigger for libvirt-daemon was defined twice for overlapping
ranges of package verions if systemd support was switched off (which
happens when building on something ancient, such as RHEL-6).

Let's combine the two triggers into the one which is called when
libvirt-daemon < 1.3.0 is uninstalled. As a side effect, virtlockd and
virtlogd might be reloaded twice after an upgrade from libvirt newer
than 1.2.1 and older than 1.3.0 (by postun script from the old libvirt
and postun trigger from the new libvirt).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 libvirt.spec.in | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index f73fcab494..e1e902c5e4 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1599,15 +1599,6 @@ if [ $1 -ge 1 ]; then
 fi
 %endif
 
-%if %{with_systemd}
-%else
-%triggerpostun daemon -- libvirt-daemon < 1.2.1
-if [ "$1" -ge "1" ]; then
-    /sbin/service virtlockd reload > /dev/null 2>&1 || :
-    /sbin/service virtlogd reload > /dev/null 2>&1 || :
-fi
-%endif
-
 # In upgrade scenario we must explicitly enable virtlockd/virtlogd
 # sockets, if libvirtd is already enabled and start them if
 # libvirtd is running, otherwise you'll get failures to start
@@ -1624,6 +1615,8 @@ if [ $1 -ge 1 ] ; then
         /sbin/chkconfig virtlogd on || :
     /sbin/service libvirtd status 1>/dev/null 2>&1 &&
         /sbin/service virtlogd start || :
+    /sbin/service virtlockd reload > /dev/null 2>&1 || :
+    /sbin/service virtlogd reload > /dev/null 2>&1 || :
 %endif
 fi
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/6] spec: Drop overlapping triggers
Posted by Daniel P. Berrangé 7 years, 2 months ago
On Wed, Feb 14, 2018 at 03:11:41PM +0100, Jiri Denemark wrote:
> The postun trigger for libvirt-daemon was defined twice for overlapping
> ranges of package verions if systemd support was switched off (which
> happens when building on something ancient, such as RHEL-6).
> 
> Let's combine the two triggers into the one which is called when
> libvirt-daemon < 1.3.0 is uninstalled. As a side effect, virtlockd and
> virtlogd might be reloaded twice after an upgrade from libvirt newer
> than 1.2.1 and older than 1.3.0 (by postun script from the old libvirt
> and postun trigger from the new libvirt).
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  libvirt.spec.in | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index f73fcab494..e1e902c5e4 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -1599,15 +1599,6 @@ if [ $1 -ge 1 ]; then
>  fi
>  %endif
>  
> -%if %{with_systemd}
> -%else
> -%triggerpostun daemon -- libvirt-daemon < 1.2.1
> -if [ "$1" -ge "1" ]; then
> -    /sbin/service virtlockd reload > /dev/null 2>&1 || :
> -    /sbin/service virtlogd reload > /dev/null 2>&1 || :
> -fi
> -%endif
> -
>  # In upgrade scenario we must explicitly enable virtlockd/virtlogd
>  # sockets, if libvirtd is already enabled and start them if
>  # libvirtd is running, otherwise you'll get failures to start
> @@ -1624,6 +1615,8 @@ if [ $1 -ge 1 ] ; then
>          /sbin/chkconfig virtlogd on || :
>      /sbin/service libvirtd status 1>/dev/null 2>&1 &&
>          /sbin/service virtlogd start || :
> +    /sbin/service virtlockd reload > /dev/null 2>&1 || :
> +    /sbin/service virtlogd reload > /dev/null 2>&1 || :
>  %endif
>  fi

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list