]> xenbits.xensource.com Git - libvirt.git/commitdiff
spec: If installing default network, restart libvirtd
authorCole Robinson <crobinso@redhat.com>
Thu, 16 Apr 2015 19:42:05 +0000 (15:42 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 26 Apr 2016 14:42:33 +0000 (10:42 -0400)
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
running.

https://bugzilla.redhat.com/show_bug.cgi?id=867546

libvirt.spec.in

index 35212dab747f8062f9366261e5f56183aa46e252..4eff5aee6f41db349a605ede485754e5de9a79b2 100644 (file)
@@ -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 try-restart libvirtd.service >/dev/null 2>&1 ||:
+      %else
+    /sbin/service libvirtd condrestart > /dev/null 2>&1 || :
+      %endif
+
 fi
     %endif