[Pkg-libvirt-maintainers] [RFC] Restart libvirtd.service after installing certain libvirt modules

Andrea Bolognani eof at kiyuko.org
Thu Jan 16 20:12:00 GMT 2025


Sergio,

topics like this one can, and indeed *should*, be discussed on the
pkg-libvirt-maintainers list. Continuing the thread there.


On Mon, Jan 13, 2025 at 06:49:48PM -0500, Sergio Durigan Junior wrote:
> Hello Andrea, Guido,
> 
> I'd like to start a discussion with you regarding the feasability of
> having other libvirt components issue a "systemctl restart
> libvirtd.service" after they're installed (on postinst, most likely).
> 
> For the record, the bug that kicked off this discussion on our
> (Canonical) side is:
> 
>   https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/2092350
> 
> Long story short, whenever the user installs a libvirt package module
> that requires the daemon to be restarted, nothing will happen and they
> won't be able to use the new feature unless they restart things by hand.
> For example:
> 
> --8<---------------cut here---------------start------------->8---
> $ sudo apt install libvirt-daemon-driver-lxc
> $ virsh --connect lxc:/// list
> error: failed to connect to the hypervisor
> error: no connection driver available for lxc:///
> --8<---------------cut here---------------end--------------->8---
> 
> We have the mechanism to auto shutdown the daemon after 120 seconds if
> nothing is using it, but on busy systems this won't work.

Or any system where the default network is active. libvirtd will quit
once it's been idle for 120 seconds but any object being active, be
that a guest or a network, prevents that from happening.

> The discussion I want to have with you is whether it makes sense to
> implement this service restart upon the installation of *certain*
> modules.  I'm not sure if this has been discussed/decided already; if it
> has, would you mind sharing the rationale with us, please?

This makes total sense, and I'm kinda surprised that we don't have it
already.

Restarting libvirtd is supposed to be a completely safe operation,
even when guests are running. We would be in trouble during regular
package upgrades otherwise!

There's an old MR by Michael that was going in the right direction:

  https://salsa.debian.org/libvirt-team/libvirt/-/merge_requests/162

Unfortunately I was unable to give it the attention it deserved at
the time and so, understandably, it's been been closed by the author.
Sorry Michael!

I think reviving that MR (things have changed a bunch in the
meantime) and extending it so that it pokes the trigger not just when
configuration is installed, but also when drivers are added, would be
the way to go.

I might take a stab at it during the weekend.

Thanks for bringing this topic to my attention!

-- 
Andrea Bolognani <eof at kiyuko.org>
Resistance is futile, you will be garbage collected.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-maintainers/attachments/20250116/a975437d/attachment.sig>


More information about the Pkg-libvirt-maintainers mailing list