]> xenbits.xensource.com Git - libvirt.git/commit
remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit
authorPeter Krempa <pkrempa@redhat.com>
Tue, 18 Jan 2022 14:00:21 +0000 (15:00 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 19 Jan 2022 15:54:33 +0000 (16:54 +0100)
commit9c800d62adfb1d7df172af2ee849fdd2c8293e1a
treebed7f87042d4bdfc99e340229774618cf989faa1
parent1652babf15cea63323411c450c408848f96e5866
remote: systemd: Remove unix sockets from filesystem when disabling a '.socket' unit

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
src/remote/libvirtd.socket.in