[PATCH] spec: Remove duplicate check of libvirtd status

Jim Fehlig posted 1 patch 1 year, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220720141212.3544-1-jfehlig@suse.com
libvirt.spec.in | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
[PATCH] spec: Remove duplicate check of libvirtd status
Posted by Jim Fehlig 1 year, 9 months ago
The %posttrans scriptlet checks if libvirtd is active within a
condition that is only executed if libvirtd is active. Remove the
duplicate check.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---

This patch contains an improvement Martin suggested while reviewing
another patch to the posttrans scriptlet

https://listman.redhat.com/archives/libvir-list/2022-July/232947.html

The problem of not restarting socket units if libvird is inactive persists,
but it is not clear if socket units need restarted on package update.

 libvirt.spec.in | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 9d788b790f..a238edf2aa 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1365,18 +1365,12 @@ then
         # own the sockets again when it comes back up. Thus we must
         # do this particular ordering, so that we get libvirtd
         # running with socket activation in use
-        /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1
-        if test $? = 0
-        then
-            /bin/systemctl stop libvirtd.service >/dev/null 2>&1 || :
-
-            /bin/systemctl try-restart \
-                    libvirtd.socket \
-                    libvirtd-ro.socket \
-                    libvirtd-admin.socket >/dev/null 2>&1 || :
-
-            /bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
-        fi
+        /bin/systemctl stop libvirtd.service >/dev/null 2>&1 || :
+        /bin/systemctl try-restart \
+                libvirtd.socket \
+                libvirtd-ro.socket \
+                libvirtd-admin.socket >/dev/null 2>&1 || :
+        /bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
     fi
 fi
 
-- 
2.36.1
Re: [PATCH] spec: Remove duplicate check of libvirtd status
Posted by Michal Prívozník 1 year, 8 months ago
On 7/20/22 16:12, Jim Fehlig wrote:
> The %posttrans scriptlet checks if libvirtd is active within a
> condition that is only executed if libvirtd is active. Remove the
> duplicate check.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
> 
> This patch contains an improvement Martin suggested while reviewing
> another patch to the posttrans scriptlet
> 
> https://listman.redhat.com/archives/libvir-list/2022-July/232947.html
> 
> The problem of not restarting socket units if libvird is inactive persists,
> but it is not clear if socket units need restarted on package update.
> 
>  libvirt.spec.in | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal
Re: [PATCH] spec: Remove duplicate check of libvirtd status
Posted by Jim Fehlig 1 year, 9 months ago
Hi,

Any comments on this patch?

Regards,
Jim

On 7/20/22 08:12, Jim Fehlig wrote:
> The %posttrans scriptlet checks if libvirtd is active within a
> condition that is only executed if libvirtd is active. Remove the
> duplicate check.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
> 
> This patch contains an improvement Martin suggested while reviewing
> another patch to the posttrans scriptlet
> 
> https://listman.redhat.com/archives/libvir-list/2022-July/232947.html
> 
> The problem of not restarting socket units if libvird is inactive persists,
> but it is not clear if socket units need restarted on package update.
> 
>   libvirt.spec.in | 18 ++++++------------
>   1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index 9d788b790f..a238edf2aa 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -1365,18 +1365,12 @@ then
>           # own the sockets again when it comes back up. Thus we must
>           # do this particular ordering, so that we get libvirtd
>           # running with socket activation in use
> -        /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1
> -        if test $? = 0
> -        then
> -            /bin/systemctl stop libvirtd.service >/dev/null 2>&1 || :
> -
> -            /bin/systemctl try-restart \
> -                    libvirtd.socket \
> -                    libvirtd-ro.socket \
> -                    libvirtd-admin.socket >/dev/null 2>&1 || :
> -
> -            /bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
> -        fi
> +        /bin/systemctl stop libvirtd.service >/dev/null 2>&1 || :
> +        /bin/systemctl try-restart \
> +                libvirtd.socket \
> +                libvirtd-ro.socket \
> +                libvirtd-admin.socket >/dev/null 2>&1 || :
> +        /bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
>       fi
>   fi
>