[PATCH] spec: Restart sockets even when libvirtd is inactive

Jim Fehlig jfehlig at suse.com
Tue Jul 19 23:51:57 UTC 2022


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?

 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
         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



More information about the libvir-list mailing list