[PATCH] spec: Restart sockets even when libvirtd is inactive
Martin Kletzander
mkletzan at redhat.com
Wed Jul 20 08:00:30 UTC 2022
On Tue, Jul 19, 2022 at 05:51:57PM -0600, Jim Fehlig wrote:
>By default libvirtd will terminate itself after 120 seconds, so it is
>likely that the daemon will not be running at package upgrade. Try
>restarting sockets even if the daemon is inactive.
>
>Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>---
>
>Assuming sockets need restarted on package update?
>
Probably not, but just in case there is a configuration change I think
it is safer to have this here.
> libvirt.spec.in | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
>diff --git a/libvirt.spec.in b/libvirt.spec.in
>index 9d788b790f..5201a14431 100644
>--- a/libvirt.spec.in
>+++ b/libvirt.spec.in
>@@ -1365,16 +1365,19 @@ 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
>+ is_active=no
> /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1
> if test $? = 0
I think this is not needed because this whole function is only called
when the daemon was active (see libvirt_daemon_schedule_restart and
libvirt_daemon_needs_restart).
That could make this whole thing even easier.
> then
>+ is_active=yes
> /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 || :
>-
>+ fi
>+ /bin/systemctl try-restart \
>+ libvirtd.socket \
>+ libvirtd-ro.socket \
>+ libvirtd-admin.socket >/dev/null 2>&1 || :
>+ if test "$is_active" = yes
>+ then
> /bin/systemctl start libvirtd.service >/dev/null 2>&1 || :
> fi
> fi
>--
>2.36.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220720/dab6e564/attachment.sig>
More information about the libvir-list
mailing list