Auto-connection request for virt-btop: libvirt interface

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.

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 virConnectGetAllDomainStats and 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-files access to the socket path would be broader and less well defined than the libvirt interface.
  • Classic confinement isn’t justified when one interface covers the need.
  • A remote-only connection over network doesn’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

This request has been added to the queue for review by the @reviewers team.

Hello @nboeger,

Thank you for the detailed request! While I can understand the necessity of this interface for the central functionality of this snap, the libvirt interface provides significantly larger privileges than listed as needed. From a user perspective, the app and its description suggests it just gathers monitoring data and it would be surprising that it could launch VMs, mount filesystems, export disks, adjust networking, etc. As such, I lean towards preserving user voice with this privileged interface, and so this is a -1 from me for auto-connect. What do other reviewers think?

I wonder, would you be able to utilize snapctl is-connected libvert to check for the interface and prompt users to run the connect command if it is missing? Use snapctl - Snap documentation With this interface, we would prefer that this prompt includes an in-depth description of the access connecting this interface provides the snap, especially those not expected for a monitoring tool.