[libvirt] [PATCH] spec: If installing default network, reload libvirtd (bz 867546)

Laine Stump laine at laine.org
Tue Apr 21 14:34:09 UTC 2015

On 04/21/2015 09:48 AM, Michal Privoznik wrote:
> On 16.04.2015 21:42, Cole Robinson wrote:
>> If libvirt-daemon-config-network is installed while libvirtd is already
>> running, the daemon needs to be restarted to pick up the change.
>> Instead let's trigger a daemon reload 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 | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> diff --git a/libvirt.spec.in b/libvirt.spec.in
>> index e08c9e7..ada0257 100644
>> --- a/libvirt.spec.in
>> +++ b/libvirt.spec.in
>> @@ -1770,6 +1770,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
> There's already a 'systemctl try-restart libvirtd.service' call just a
> few lines below. They were added in 4789fb2e. I think we can use them -
> also, I'm not sure why it doesn't work since we are restarting daemon
> even now (without this patch).

I think the issue may be that the default network is in a different
sub-package than libvirtd, so libvirtd is already started/restart by the
time the file is installed. Or something like that. I do recall that
this is a real problem though.

I also meant to respond to this patch and again got distracted - when I
tried to manually do that this patch supposedly does, I got an error:

I copied a new XML file into /etc/libvirt/qemu/networks and a link for
it into /etc/libvirt/qemu/networks/autostart, then called systemctl
reload libvirtd.service, I ended up with a bridge device created with
the correct IP address, but libvirt showed the new network as inactive
and this error log:

networkCheckRouteCollision:121 : internal error: Network is already in
use by interface virbr3

(virbr3 is the bridge created for this network; it didn't exist prior to
telling libvirtd to reload, and there is no other route in conflict with

I didn't have time to investigate, but am wondering if the patch is
really doing what is intended.

More information about the libvir-list mailing list