• Jonathon Jongsma's avatar
    Add systemd socket activation · 183e2fec
    Jonathon Jongsma authored
    If we are configured to use the systemd init script, also add support
    for systemd socket activation. systemd will listen on the socket that is
    used to communicate between the session agent and the system daemon.
    When the session agent connects, the system daemon will automatically be
    started. The socket will be enabled only if the required virtio-port
    device exists. The socket is disabled when the device is removed.
    This has a couple minor advantages to the previous approach:
      - For VMS that are not running a graphical desktop (and thus no
        session agents are running), the system vdagent daemon won't get
        started at all even if the spice virtio port is configured. Only the
        socket will be enabled. In the previous approach, the system daemon
        was started when the virtio device was added regardless of whether
        it was needed or not.
      - Solves issues related to switching between systemd targets. With the
        previous approach, when a user switches to a different target
        ("systemctl isolate multi-user.target"), spice-vdagentd.target was
        stopped by systemd (since "isolate" by definition stops all targets
        except the one specified). This meant that if the user subsequently
        switched back to graphical.target, the spice-vdagentd.target would
        still be disabled and vdagent functionality would not work. With
        this change, the socket will still be listening after switching to a
        different target, so as soon as a session agent tries to connect to
        the socket, the system daemon will get restarted.
    Fixes: rhbz#1340160
    Signed-off-by: default avatarJonathon Jongsma <jjongsma@redhat.com>
    Acked-by: Victor Toso's avatarVictor Toso <victortoso@redhat.com>
70-spice-vdagentd.rules 140 Bytes