]> xenbits.xensource.com Git - libvirt.git/commitdiff
systemd: Introduce systemd_service_limitnofile_extra_in
authorAndrea Bolognani <abologna@redhat.com>
Thu, 28 Sep 2023 09:51:16 +0000 (11:51 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 25 Oct 2023 10:19:21 +0000 (12:19 +0200)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
14 files changed:
src/ch/meson.build
src/ch/virtchd.service.extra.in
src/locking/meson.build
src/locking/virtlockd.service.in
src/logging/meson.build
src/logging/virtlogd.service.in
src/lxc/meson.build
src/lxc/virtlxcd.service.extra.in
src/meson.build
src/qemu/meson.build
src/qemu/virtqemud.service.extra.in
src/remote/libvirtd.service.in
src/remote/meson.build
src/virtd.service.limitnofile.extra.in [new file with mode: 0644]

index 1d612a7369f4739e662fc2527e58951f48b08af3..604329e9c7e1781b092a8bb37c4bb58ceb936f83 100644 (file)
@@ -62,6 +62,7 @@ if conf.has('WITH_CH')
     'name': 'Cloud Hypervisor',
     'service_extra_in': [
       files('virtchd.service.extra.in'),
+      systemd_service_limitnofile_extra_in,
     ],
   }
 
index bc2fef57cc588f222ad568c28b8b4f9a7a50f491..626cf0a21b4a08537447f66418675168992c1ad3 100644 (file)
@@ -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
index 6b3cd781d1875ba84982c2618f5b52bf20de5d89..f3bdf57483a904ec78ee121c7011631c0d31e615 100644 (file)
@@ -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'),
index ce00b6def9a86b4267d5476c380d42e561d0bcd5..5c374fea8f4e4beb92945c902f4c50410623c90f 100644 (file)
@@ -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
index 1527f91faf88332f93772c1cc0910353b5a90e7e..a3d0ad297ce586d1999175ac97662afb5ca55afe 100644 (file)
@@ -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'),
index 52c9e5bb9e29d444c40a32142e31e7a15b9b9531..9108dd1ff9e4f5e9383ea18d9ffb790a05a3cbb7 100644 (file)
@@ -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
index 198e282e635089b168c4c5d0882ae1de30e0ac3f..0c4d51d8b941235b908ed0e88cec2204bc4c47da 100644 (file)
@@ -167,6 +167,7 @@ if conf.has('WITH_LXC')
     'name': 'LXC',
     'service_extra_in': [
       files('virtlxcd.service.extra.in'),
+      systemd_service_limitnofile_extra_in,
     ],
   }
 
index bc2fef57cc588f222ad568c28b8b4f9a7a50f491..626cf0a21b4a08537447f66418675168992c1ad3 100644 (file)
@@ -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
index f3814d75ce2435f8c99c26e50e37b79b8b7f7a49..a9e6b521ee2da6e36ccf313ab311ec7197593951 100644 (file)
@@ -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)
index fff61ddf27513d71ec1d2c84f0149e7088e2e504..09f79f52eec3019cfb281a6e7e221a677446faef 100644 (file)
@@ -186,6 +186,7 @@ if conf.has('WITH_QEMU')
     'name': 'QEMU',
     'service_extra_in': [
       files('virtqemud.service.extra.in'),
+      systemd_service_limitnofile_extra_in,
     ],
   }
 
index 585e1e82eb1dba499505cde3e32b7b620c42c6c3..48b349b48ad922270bb74d0dfa8d8193fa7ce8df 100644 (file)
@@ -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
index 24a6712b751a45c5119ed4ed768c1f13695b9df1..8dc6df2138e9d4c3085c82ab1ea294f81190aaf1 100644 (file)
@@ -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
index 41c73360d12223b6eafc1e1496d1f89a13afa6af..e2960195f7be3969c048d5b30222c8d4e82c3ad6 100644 (file)
@@ -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 (file)
index 0000000..42c1960
--- /dev/null
@@ -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