Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/ch/meson.build | 1 +
src/ch/virtchd.service.extra.in | 4 ----
src/locking/meson.build | 3 +++
src/locking/virtlockd.service.in | 4 ----
src/logging/meson.build | 3 +++
src/logging/virtlogd.service.in | 4 ----
src/lxc/meson.build | 1 +
src/lxc/virtlxcd.service.extra.in | 4 ----
src/meson.build | 5 +++++
src/qemu/meson.build | 1 +
src/qemu/virtqemud.service.extra.in | 4 ----
src/remote/libvirtd.service.in | 4 ----
src/remote/meson.build | 3 +++
src/virtd.service.limitnofile.extra.in | 5 +++++
14 files changed, 22 insertions(+), 24 deletions(-)
create mode 100644 src/virtd.service.limitnofile.extra.in
diff --git a/src/ch/meson.build b/src/ch/meson.build
index 7cee90d0da..0760d1f8e1 100644
--- a/src/ch/meson.build
+++ b/src/ch/meson.build
@@ -60,6 +60,7 @@ if conf.has('WITH_CH')
'name': 'Cloud Hypervisor',
'service_extra_in': [
files('virtchd.service.extra.in'),
+ systemd_service_limitnofile_extra_in,
],
}
diff --git a/src/ch/virtchd.service.extra.in b/src/ch/virtchd.service.extra.in
index bc2fef57cc..626cf0a21b 100644
--- a/src/ch/virtchd.service.extra.in
+++ b/src/ch/virtchd.service.extra.in
@@ -5,10 +5,6 @@ After=remote-fs.target
[Service]
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 daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of
diff --git a/src/locking/meson.build b/src/locking/meson.build
index 6b3cd781d1..f3bdf57483 100644
--- a/src/locking/meson.build
+++ b/src/locking/meson.build
@@ -144,6 +144,9 @@ if conf.has('WITH_LIBVIRTD')
virt_daemon_units += {
'service': 'virtlockd',
'service_in': files('virtlockd.service.in'),
+ 'service_extra_in': [
+ systemd_service_limitnofile_extra_in,
+ ],
'name': 'locking',
'sockets': [ 'main', 'admin' ],
'socket_in': files('virtlockd.socket.in'),
diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
index ce00b6def9..5c374fea8f 100644
--- a/src/locking/virtlockd.service.in
+++ b/src/locking/virtlockd.service.in
@@ -17,10 +17,6 @@ ExecReload=/bin/kill -USR1 $MAINPID
# cause the machine to be fenced (rebooted), so make
# sure we discourage OOM killer
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]
WantedBy=multi-user.target
diff --git a/src/logging/meson.build b/src/logging/meson.build
index 1527f91faf..a3d0ad297c 100644
--- a/src/logging/meson.build
+++ b/src/logging/meson.build
@@ -91,6 +91,9 @@ if conf.has('WITH_LIBVIRTD')
virt_daemon_units += {
'service': 'virtlogd',
'service_in': files('virtlogd.service.in'),
+ 'service_extra_in': [
+ systemd_service_limitnofile_extra_in,
+ ],
'name': 'logging',
'sockets': [ 'main', 'admin' ],
'socket_in': files('virtlogd.socket.in'),
diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
index 52c9e5bb9e..9108dd1ff9 100644
--- a/src/logging/virtlogd.service.in
+++ b/src/logging/virtlogd.service.in
@@ -17,10 +17,6 @@ ExecReload=/bin/kill -USR1 $MAINPID
# cause the machine to be fenced (rebooted), so make
# sure we discourage OOM killer
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]
WantedBy=multi-user.target
diff --git a/src/lxc/meson.build b/src/lxc/meson.build
index 198e282e63..0c4d51d8b9 100644
--- a/src/lxc/meson.build
+++ b/src/lxc/meson.build
@@ -167,6 +167,7 @@ if conf.has('WITH_LXC')
'name': 'LXC',
'service_extra_in': [
files('virtlxcd.service.extra.in'),
+ systemd_service_limitnofile_extra_in,
],
}
diff --git a/src/lxc/virtlxcd.service.extra.in b/src/lxc/virtlxcd.service.extra.in
index bc2fef57cc..626cf0a21b 100644
--- a/src/lxc/virtlxcd.service.extra.in
+++ b/src/lxc/virtlxcd.service.extra.in
@@ -5,10 +5,6 @@ After=remote-fs.target
[Service]
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 daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of
diff --git a/src/meson.build b/src/meson.build
index f3814d75ce..a9e6b521ee 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -191,6 +191,11 @@ virt_test_aug_dir = datadir / 'augeas' / 'lenses' /
'tests'
# guest unit files to install
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:
# generate libvirt daemon systemd unit files
# * service - name of the service (required)
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index fff61ddf27..09f79f52ee 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -186,6 +186,7 @@ if conf.has('WITH_QEMU')
'name': 'QEMU',
'service_extra_in': [
files('virtqemud.service.extra.in'),
+ systemd_service_limitnofile_extra_in,
],
}
diff --git a/src/qemu/virtqemud.service.extra.in b/src/qemu/virtqemud.service.extra.in
index 585e1e82eb..48b349b48a 100644
--- a/src/qemu/virtqemud.service.extra.in
+++ b/src/qemu/virtqemud.service.extra.in
@@ -9,10 +9,6 @@ After=remote-fs.target
[Service]
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 daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 24a6712b75..8dc6df2138 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -33,10 +33,6 @@ ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
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 daemon, which can limit the number of domains for some hypervisors.
# A conservative default of 8 tasks per guest results in a TasksMax of
diff --git a/src/remote/meson.build b/src/remote/meson.build
index 41c73360d1..e2960195f7 100644
--- a/src/remote/meson.build
+++ b/src/remote/meson.build
@@ -191,6 +191,9 @@ if conf.has('WITH_REMOTE')
virt_daemon_units += {
'service': 'libvirtd',
'service_in': files('libvirtd.service.in'),
+ 'service_extra_in': [
+ systemd_service_limitnofile_extra_in,
+ ],
'name': 'legacy monolithic',
'sockets': [ 'main', 'ro', 'admin', 'tcp',
'tls' ],
'socket_in': files('libvirtd.socket.in'),
diff --git a/src/virtd.service.limitnofile.extra.in
b/src/virtd.service.limitnofile.extra.in
new file mode 100644
index 0000000000..42c1960a7d
--- /dev/null
+++ b/src/virtd.service.limitnofile.extra.in
@@ -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
--
2.41.0