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
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
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 >
© 2016 - 2024 Red Hat, Inc.