On Fri, Jun 27, 2025 at 02:03:31PM -0400, Daniel Kahn Gillmor wrote: > Enable qemu to be socket-activated based on a spice connection. > > Note that this depends on un-deprecating > spice_server_set_listen_socket_fd, see > https://gitlab.freedesktop.org/spice/spice/-/merge_requests/240 > > This partially addresses > https://gitlab.com/qemu-project/qemu/-/issues/3011
I don't think this is showing the right approach for systemd socket activation. Spice is rather an odd-ball part of QEMU today that isn't using modern best practice config design, so what looks simple from a Spice POV is not aligned with what we need for QEMU. Historically we've long supported passing pre-opened FDs of any kind into QEMU at launch time, but we didn't rely on systemd socket activation. We just passed the FDs in and referenced them numerically in the config. At runtime we then also had the ability to pass in pre-opend FDs over QMP, which we referenced by name. IMHO for systemd socket activation, we want to introduce the ability to reference sockets by name at startup, so it is aligned with what we can do at runtime. Primarily this comes down to having logic present in the socket_get_fd method, such that when there is no current monitor, we use the systemd named sockets. We should also have logic to validate that we have consumed all systemd sockets, before we move out of startup phase, in order to detect config errors. This indicates should we proactively parse the socket activation env at starutp and record all FDs, and keep track of which are consumed by the config. Meanwhile both -vnc and -spice need updating to have their CLI modelled in QAPI, and use the SocketAdddress struct config, which would unlock FD passing both with & without systemd socket activation. And then there are some hard questions about how we integrate this with the various helper programs like qemu-nbd, and friends, which all already support systemd socket activation but fail to validate the names, making it hard to add propert support while retaining back compat. This is all a major amount of work, which is partly why we've not addressed this yet, despite it being on the wishlist for years already With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|