diff mbox

spec: If installing default network, restart libvirtd

Message ID ddaa943a03f4808033eaca543978644ffd787034.1461617550.git.crobinso@redhat.com
State Superseded
Headers show

Commit Message

Cole Robinson April 25, 2016, 9:13 p.m. UTC
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
---
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:

http://www.redhat.com/archives/libvir-list/2016-April/msg01624.html

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(+)

-- 
2.7.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson April 26, 2016, 2:15 p.m. UTC | #1
On 04/26/2016 10:12 AM, Laine Stump wrote:
> On 04/25/2016 05:13 PM, Cole Robinson wrote:

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

>> ---

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

>>

>> http://www.redhat.com/archives/libvir-list/2016-April/msg01624.html

>>

>> And in fact daemon restart is what the spec triggers on libvirt-daemon

>> upgrade anyways, so this isn't anything new WRT packaging.

> 

> This logic makes sense, but does it do the right thing on a fresh install?

> (i.e. would it possibly try to restart libvirtd.service before it could be

> started?)

> 

> If you've tried a fresh install of all packages simultaneously and this

> restart doesn't cause any sort of error message, then ACK.

> 


Urgh... I sent the wrong patch anyways. This was the old one, the new one is
supposed to be doing try-restart/condrestart, which does the correct thing in
case the daemon isn't running. I'll send v2

>>

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

>> +

>>   fi

>>       %endif

>>   

> 


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

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
+
 fi
     %endif