1
0
mirror of https://github.com/systemd/systemd synced 2025-10-06 00:13:24 +02:00

units: Add systemd-machined.socket

This commit is contained in:
Daan De Meyer
2025-03-18 14:37:15 +01:00
committed by Lennart Poettering
parent d2ce0db7a7
commit 04a44e25b9
4 changed files with 35 additions and 7 deletions

View File

@@ -806,13 +806,18 @@ static int manager_varlink_init_machine(Manager *m) {
if (r < 0)
return log_error_errno(r, "Failed to register varlink methods: %m");
r = sd_varlink_server_listen_address(s, "/run/systemd/machine/io.systemd.Machine", 0666 | SD_VARLINK_SERVER_MODE_MKDIR_0755);
r = sd_varlink_server_listen_auto(s);
if (r < 0)
return log_error_errno(r, "Failed to bind to io.systemd.Machine varlink socket: %m");
return log_error_errno(r, "Failed to bind to passed Varlink sockets: %m");
if (r == 0) {
r = sd_varlink_server_listen_address(s, "/run/systemd/machine/io.systemd.Machine", 0666 | SD_VARLINK_SERVER_MODE_MKDIR_0755);
if (r < 0)
return log_error_errno(r, "Failed to bind to io.systemd.Machine varlink socket: %m");
r = sd_varlink_server_listen_address(s, "/run/systemd/machine/io.systemd.MachineImage", 0666);
if (r < 0)
return log_error_errno(r, "Failed to bind to io.systemd.MachineImage varlink socket: %m");
r = sd_varlink_server_listen_address(s, "/run/systemd/machine/io.systemd.MachineImage", 0666);
if (r < 0)
return log_error_errno(r, "Failed to bind to io.systemd.MachineImage varlink socket: %m");
}
r = sd_varlink_server_attach_event(s, m->event, SD_EVENT_PRIORITY_NORMAL);
if (r < 0)

View File

@@ -483,6 +483,11 @@ units = [
'conditions' : ['ENABLE_MACHINED'],
'symlinks' : ['dbus-org.freedesktop.machine1.service'],
},
{
'file' : 'systemd-machined.socket',
'conditions' : ['ENABLE_MACHINED'],
'symlinks' : ['sockets.target.wants/'],
},
{
'file' : 'systemd-modules-load.service.in',
'conditions' : ['HAVE_KMOD'],

View File

@@ -12,8 +12,8 @@ Description=Virtual Machine and Container Registration Service
Documentation=man:systemd-machined.service(8)
Documentation=man:org.freedesktop.machine1(5)
Wants=machine.slice
After=machine.slice
Wants=machine.slice systemd-machined.socket
After=machine.slice systemd-machined.socket
RequiresMountsFor=/var/lib/machines
[Service]

View File

@@ -0,0 +1,18 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Virtual Machine and Container Registration Service Socket
Documentation=man:systemd-machined.service(8)
[Socket]
ListenStream=/run/systemd/machine/io.systemd.Machine
ListenStream=/run/systemd/machine/io.systemd.MachineImage
FileDescriptorName=varlink
SocketMode=0666