[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] spec: If installing default network, restart libvirtd

If libvirt-daemon-config-network is installed while libvirtd is already
running, the daemon doesn't notice the network. Users then have to
manually restart libvirtd (or reboot) to pick up the network.

Instead let's trigger a daemon restart when the package is first installed.
Then the default network is available immediately if libvirtd was already

Plain restart is kind of suboptimal since it will drop all open
libvirt connections. Ideally we would use reload which is meant
for this case, but it's kinda crashy with current git:


And in fact daemon restart is what the spec triggers on libvirt-daemon
upgrade anyways, so this isn't anything new WRT packaging.

 libvirt.spec.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 35212da..1a04c88 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1849,6 +1849,14 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
          < %{_datadir}/libvirt/networks/default.xml \
          > %{_sysconfdir}/libvirt/qemu/networks/default.xml
     ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
+    # Make sure libvirt picks up the new network defininiton
+      %if %{with_systemd}
+    /bin/systemctl reload libvirtd.service >/dev/null 2>&1 ||:
+      %else
+    /sbin/service libvirtd reload > /dev/null 2>&1 || :
+      %endif

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]