systemd: Introduce systemd_service_limitnofile_extra_in

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2023-09-28 11:51:16 +02:00
parent c8ae549cd5
commit 3b16a13f14
14 changed files with 22 additions and 24 deletions

View File

@ -62,6 +62,7 @@ if conf.has('WITH_CH')
'name': 'Cloud Hypervisor', 'name': 'Cloud Hypervisor',
'service_extra_in': [ 'service_extra_in': [
files('virtchd.service.extra.in'), files('virtchd.service.extra.in'),
systemd_service_limitnofile_extra_in,
], ],
} }

View File

@ -5,10 +5,6 @@ After=remote-fs.target
[Service] [Service]
KillMode=process KillMode=process
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
# The cgroups pids controller can limit the number of tasks started by # The cgroups pids controller can limit the number of tasks started by
# the daemon, which can limit the number of domains for some hypervisors. # the daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of # A conservative default of 8 tasks per guest results in a TasksMax of

View File

@ -144,6 +144,9 @@ if conf.has('WITH_LIBVIRTD')
virt_daemon_units += { virt_daemon_units += {
'service': 'virtlockd', 'service': 'virtlockd',
'service_in': files('virtlockd.service.in'), 'service_in': files('virtlockd.service.in'),
'service_extra_in': [
systemd_service_limitnofile_extra_in,
],
'name': 'locking', 'name': 'locking',
'sockets': [ 'main', 'admin' ], 'sockets': [ 'main', 'admin' ],
'socket_in': files('virtlockd.socket.in'), 'socket_in': files('virtlockd.socket.in'),

View File

@ -17,10 +17,6 @@ ExecReload=/bin/kill -USR1 $MAINPID
# cause the machine to be fenced (rebooted), so make # cause the machine to be fenced (rebooted), so make
# sure we discourage OOM killer # sure we discourage OOM killer
OOMScoreAdjust=-900 OOMScoreAdjust=-900
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -91,6 +91,9 @@ if conf.has('WITH_LIBVIRTD')
virt_daemon_units += { virt_daemon_units += {
'service': 'virtlogd', 'service': 'virtlogd',
'service_in': files('virtlogd.service.in'), 'service_in': files('virtlogd.service.in'),
'service_extra_in': [
systemd_service_limitnofile_extra_in,
],
'name': 'logging', 'name': 'logging',
'sockets': [ 'main', 'admin' ], 'sockets': [ 'main', 'admin' ],
'socket_in': files('virtlogd.socket.in'), 'socket_in': files('virtlogd.socket.in'),

View File

@ -17,10 +17,6 @@ ExecReload=/bin/kill -USR1 $MAINPID
# cause the machine to be fenced (rebooted), so make # cause the machine to be fenced (rebooted), so make
# sure we discourage OOM killer # sure we discourage OOM killer
OOMScoreAdjust=-900 OOMScoreAdjust=-900
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -167,6 +167,7 @@ if conf.has('WITH_LXC')
'name': 'LXC', 'name': 'LXC',
'service_extra_in': [ 'service_extra_in': [
files('virtlxcd.service.extra.in'), files('virtlxcd.service.extra.in'),
systemd_service_limitnofile_extra_in,
], ],
} }

View File

@ -5,10 +5,6 @@ After=remote-fs.target
[Service] [Service]
KillMode=process KillMode=process
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
# The cgroups pids controller can limit the number of tasks started by # The cgroups pids controller can limit the number of tasks started by
# the daemon, which can limit the number of domains for some hypervisors. # the daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of # A conservative default of 8 tasks per guest results in a TasksMax of

View File

@ -191,6 +191,11 @@ virt_test_aug_dir = datadir / 'augeas' / 'lenses' / 'tests'
# guest unit files to install # guest unit files to install
guest_unit_files = [] guest_unit_files = []
# systemd_*_extra_in:
# snippets that are shared by multiple units
# can be used in service_extra_in/socket_extra_in (see below)
systemd_service_limitnofile_extra_in = files('virtd.service.limitnofile.extra.in')
# virt_daemon_units: # virt_daemon_units:
# generate libvirt daemon systemd unit files # generate libvirt daemon systemd unit files
# * service - name of the service (required) # * service - name of the service (required)

View File

@ -186,6 +186,7 @@ if conf.has('WITH_QEMU')
'name': 'QEMU', 'name': 'QEMU',
'service_extra_in': [ 'service_extra_in': [
files('virtqemud.service.extra.in'), files('virtqemud.service.extra.in'),
systemd_service_limitnofile_extra_in,
], ],
} }

View File

@ -9,10 +9,6 @@ After=remote-fs.target
[Service] [Service]
KillMode=process KillMode=process
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
# The cgroups pids controller can limit the number of tasks started by # The cgroups pids controller can limit the number of tasks started by
# the daemon, which can limit the number of domains for some hypervisors. # the daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of # A conservative default of 8 tasks per guest results in a TasksMax of

View File

@ -33,10 +33,6 @@ ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288
# The cgroups pids controller can limit the number of tasks started by # The cgroups pids controller can limit the number of tasks started by
# the daemon, which can limit the number of domains for some hypervisors. # the daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of # A conservative default of 8 tasks per guest results in a TasksMax of

View File

@ -191,6 +191,9 @@ if conf.has('WITH_REMOTE')
virt_daemon_units += { virt_daemon_units += {
'service': 'libvirtd', 'service': 'libvirtd',
'service_in': files('libvirtd.service.in'), 'service_in': files('libvirtd.service.in'),
'service_extra_in': [
systemd_service_limitnofile_extra_in,
],
'name': 'legacy monolithic', 'name': 'legacy monolithic',
'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ], 'sockets': [ 'main', 'ro', 'admin', 'tcp', 'tls' ],
'socket_in': files('libvirtd.socket.in'), 'socket_in': files('libvirtd.socket.in'),

View File

@ -0,0 +1,5 @@
[Service]
# Raise hard limits to match behaviour of systemd >= 240.
# During startup, daemon will set soft limit to match hard limit
# per systemd recommendations
LimitNOFILE=1024:524288