[PATCH] remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit
Ani Sinha
ani at anisinha.ca
Tue Jan 18 15:31:38 UTC 2022
On Tue, 18 Jan 2022, Peter Krempa wrote:
> The existence of the unix socket path is used by the remote driver to
> determine whether modular daemons are in use, so if the socket file
> stays behind and the user decided to switch from modular to monolithic
> daemon which was socket activated, the remote driver will insist on
> picking '/var/run/libvirt/virtqemud-sock', even when it's no longer in
> use:
>
> # systemctl start libvirtd.service
> # virsh list
> Id Name State
> --------------------
>
> # systemctl stop libvirtd.service
> Warning: Stopping libvirtd.service, but it can still be activated by:
> libvirtd.socket
> libvirtd-ro.socket
> libvirtd-admin.socket
> # systemctl start virtqemud.socket
> # virsh list
> Id Name State
> --------------------
>
> # systemctl stop virtqemud.socket
> # systemctl start libvirtd.service
> # virsh list
> error: failed to connect to the hypervisor
> error: Failed to connect socket to '/var/run/libvirt/virtqemud-sock': Connection refused
>
> # virsh -c 'qemu:///system?socket=/var/run/libvirt/libvirt-sock' list
> Id Name State
> --------------------
>
> Fix this by instructing systemd to delete the socket file when
> deactivating the unit file for the socket.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
Reviewed-by: Ani Sinha <ani at anisinha.ca>
> ---
> src/remote/libvirtd.socket.in | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/remote/libvirtd.socket.in b/src/remote/libvirtd.socket.in
> index 85b4aa800a..0f349656f5 100644
> --- a/src/remote/libvirtd.socket.in
> +++ b/src/remote/libvirtd.socket.in
> @@ -9,6 +9,7 @@ Before=@service at .service
> ListenStream=@runstatedir@/libvirt/@sockprefix at -sock
> Service=@service at .service
> SocketMode=@mode@
> +RemoveOnStop=yes
>
> [Install]
> WantedBy=sockets.target
> --
> 2.34.1
>
>
More information about the libvir-list
mailing list