Hello snap reviewers,
I’d like to request auto-connection of the libvirt interface for my snap virt-btop.
About the snap virt-btop is a btop-style terminal UI for monitoring libvirt/KVM virtual machines. It shows per-VM CPU, memory, disk I/O and network I/O with live graphs, plus combined host and guest totals. It is a read-only monitoring tool.
- Source: GitHub - nboeger/virt-btop: A btop like interface for VM's · GitHub (GPL-3.0)
- Store name:
virt-btop(strict confinement, base core22) - It’s a Go app that uses libvirt’s C API through
libvirt.org/go/libvirt. It loadslibvirt.so.0at runtime, and the snap bundleslibvirt0via stage-packages.
Why libvirt is needed
The tool’s whole purpose is to read VM statistics from the host’s libvirt daemon. It does that over the libvirt UNIX socket, /run/libvirt/libvirt-sock-ro
(the read-only socket). Without access to that socket, the snap can’t list or monitor any VMs, so it does nothing useful. The network plug doesn’t help here,
because the main use case is the local qemu:///system connection.
What the snap does with the access
- By default it opens a read-only connection (
virConnectOpenReadOnly). It can’t start, stop, create or modify VMs, and it doesn’t read disk images or guest data. - It only calls the statistics and info APIs, such as
virConnectGetAllDomainStatsand domain state and metadata queries. - Optionally, if the user passes
--read-write, it can enable guest memory statistics reporting on running VMs (virDomainSetMemoryStatsPeriod, live only, nothing persisted). It never starts, stops or reconfigures VMs. - It doesn’t spawn
virsh, run shell commands, or write outside its own snap data.
Why auto-connect
The snap has no function without this interface. With auto-connect, a user can install it and run it straight away, as with btop and similar monitoring
tools. Without it, the first run fails and the user has to find and run snap connect virt-btop:libvirt. They would see a connection error before knowing that.
Alternatives I considered
system-filesaccess to the socket path would be broader and less well defined than thelibvirtinterface.- Classic confinement isn’t justified when one interface covers the need.
- A remote-only connection over
networkdoesn’t cover the local-host use case.
Users can still only reach the socket if they are already allowed to talk to libvirt on the host (via the libvirt group or by running as root). The snap
doesn’t grant extra privileges to unprivileged users.
If you need more detail, such as the snapcraft.yaml, the list of libvirt calls, or a walkthrough of the code, I’m happy to provide it. Thanks for your time.
Nathan Boeger