1
0
Fork 0

systemd: used drop-ins for configuration

Resolves: RHEL-97580

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2026-03-03 20:01:03 +01:00
parent 04c6a0dfba
commit a8a9d38687
8 changed files with 37 additions and 17 deletions

1
00-tuned.conf.systemd Normal file
View file

@ -0,0 +1 @@
[Manager]

View file

@ -1,6 +1,7 @@
NAME = tuned NAME = tuned
# set to devel for nightly GIT snapshot # set to devel for nightly GIT snapshot
BUILD = release BUILD = release
SYSTEMD_SUPPORT = 1
# which config to use in mock-build target # which config to use in mock-build target
MOCK_CONFIG = rhel-7-x86_64 MOCK_CONFIG = rhel-7-x86_64
# scratch-build for triggering Jenkins # scratch-build for triggering Jenkins
@ -72,9 +73,9 @@ release-cp: release-dir
cp -a AUTHORS COPYING INSTALL README.md $(VERSIONED_NAME) cp -a AUTHORS COPYING INSTALL README.md $(VERSIONED_NAME)
cp -a tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \ cp -a tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \
tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \ tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned.grub \
92-tuned.install bootcmdline modules.conf com.redhat.tuned.policy \ 00-tuned.conf.systemd 92-tuned.install bootcmdline modules.conf \
tuned-gui.py tuned-gui.glade tuned-ppd.py \ com.redhat.tuned.policy tuned-gui.py tuned-gui.glade tuned-ppd.py \
tuned-gui.desktop functions $(VERSIONED_NAME) tuned-gui.desktop functions $(VERSIONED_NAME)
cp -a doc experiments libexec man profiles systemtap tuned contrib icons \ cp -a doc experiments libexec man profiles systemtap tuned contrib icons \
tests $(VERSIONED_NAME) tests $(VERSIONED_NAME)
@ -210,14 +211,21 @@ install: install-dirs
# runtime directory # runtime directory
install -Dpm 0644 tuned.tmpfiles $(DESTDIR)$(TMPFILESDIR)/tuned.conf install -Dpm 0644 tuned.tmpfiles $(DESTDIR)$(TMPFILESDIR)/tuned.conf
ifeq ($(SYSTEMD_SUPPORT), 1)
# systemd units # systemd units
install -Dpm 0644 tuned.service $(DESTDIR)$(UNITDIR)/tuned.service install -Dpm 0644 tuned.service $(DESTDIR)$(UNITDIR)/tuned.service
endif
# dbus configuration # dbus configuration
install -Dpm 0644 dbus.conf $(DESTDIR)$(DATADIR)/dbus-1/system.d/com.redhat.tuned.conf install -Dpm 0644 dbus.conf $(DESTDIR)$(DATADIR)/dbus-1/system.d/com.redhat.tuned.conf
# grub template # grub template
install -Dpm 0755 00_tuned $(DESTDIR)$(SYSCONFDIR)/grub.d/00_tuned install -Dpm 0755 00_tuned.grub $(DESTDIR)$(SYSCONFDIR)/grub.d/00_tuned
ifeq ($(SYSTEMD_SUPPORT), 1)
# systemd template
install -Dpm 0644 00-tuned.conf.systemd $(DESTDIR)$(SYSCONFDIR)/systemd/system.conf.d/00-tuned.conf
endif
# kernel install hook # kernel install hook
install -Dpm 0755 92-tuned.install $(DESTDIR)$(KERNELINSTALLHOOKDIR)/92-tuned.install install -Dpm 0755 92-tuned.install $(DESTDIR)$(KERNELINSTALLHOOKDIR)/92-tuned.install

View file

@ -12,9 +12,9 @@ start() {
else else
DRACUT_HOOK_DIR="/usr/lib/dracut/hooks/pre-udev" DRACUT_HOOK_DIR="/usr/lib/dracut/hooks/pre-udev"
fi fi
mkdir -p "${TUNED_tmpdir}/etc/systemd" mkdir -p "${TUNED_tmpdir}/etc/systemd/system.conf.d"
mkdir -p "${TUNED_tmpdir}${DRACUT_HOOK_DIR}" mkdir -p "${TUNED_tmpdir}${DRACUT_HOOK_DIR}"
cp /etc/systemd/system.conf "${TUNED_tmpdir}/etc/systemd/" cp /etc/systemd/system.conf.d/00-tuned.conf "${TUNED_tmpdir}/etc/systemd/system.conf.d/00-tuned.conf"
cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}${DRACUT_HOOK_DIR}" cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}${DRACUT_HOOK_DIR}"
setup_kvm_mod_low_latency setup_kvm_mod_low_latency
disable_ksm disable_ksm

View file

@ -63,4 +63,4 @@ priority=10
initrd_remove_dir=True initrd_remove_dir=True
initrd_dst_img=tuned-initrd.img initrd_dst_img=tuned-initrd.img
initrd_add_dir=${tmpdir} initrd_add_dir=${tmpdir}
cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} systemd.cpu_affinity=${not_isolated_cores} intel_pstate=disable nosoftlockup cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup

View file

@ -519,6 +519,9 @@ fi
%config(noreplace) %{_sysconfdir}/tuned/tuned-main.conf %config(noreplace) %{_sysconfdir}/tuned/tuned-main.conf
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/tuned/bootcmdline %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/tuned/bootcmdline
%verify(not size mtime md5) %{_sysconfdir}/modprobe.d/tuned.conf %verify(not size mtime md5) %{_sysconfdir}/modprobe.d/tuned.conf
# https://bugzilla.redhat.com/show_bug.cgi?id=2444143
%dir %{_sysconfdir}/systemd/system.conf.d
%verify(not size mtime md5) %{_sysconfdir}/systemd/system.conf.d/00-tuned.conf
%{_tmpfilesdir}/tuned.conf %{_tmpfilesdir}/tuned.conf
%{_unitdir}/tuned.service %{_unitdir}/tuned.service
%dir %{_localstatedir}/log/tuned %dir %{_localstatedir}/log/tuned

View file

@ -57,15 +57,19 @@ PROCFS_MOUNT_POINT = "/proc"
DEF_CGROUP_MOUNT_POINT = "/sys/fs/cgroup/cpuset" DEF_CGROUP_MOUNT_POINT = "/sys/fs/cgroup/cpuset"
DEF_CGROUP_MODE = 0o770 DEF_CGROUP_MODE = 0o770
# systemd paths used by multiple plugins
SYSTEMD_CFG_PATH = "/etc/systemd"
# service plugin configuration # service plugin configuration
SERVICE_SYSTEMD_CFG_PATH = "/etc/systemd/system/%s.service.d" SERVICE_SYSTEMD_CFG_PATH = SYSTEMD_CFG_PATH + "/system/%s.service.d"
DEF_SERVICE_CFG_DIR_MODE = 0o755 DEF_SERVICE_CFG_DIR_MODE = 0o755
# modules plugin configuration # modules plugin configuration
MODULES_FILE = "/etc/modprobe.d/tuned.conf" MODULES_FILE = "/etc/modprobe.d/tuned.conf"
# systemd plugin configuration # systemd plugin configuration
SYSTEMD_SYSTEM_CONF_FILE = "/etc/systemd/system.conf" SYSTEMD_SYSTEM_CONF_FILE = SYSTEMD_CFG_PATH + "/system.conf.d/00-tuned.conf"
SYSTEMD_SYSTEM_CONF_HEADER = "[Manager]"
SYSTEMD_CPUAFFINITY_VAR = "CPUAffinity" SYSTEMD_CPUAFFINITY_VAR = "CPUAffinity"
# irqbalance plugin configuration # irqbalance plugin configuration

View file

@ -15,10 +15,10 @@ class SystemdPlugin(base.Plugin):
Plug-in for tuning systemd options. Plug-in for tuning systemd options.
The [option]`cpu_affinity` option allows setting CPUAffinity in The [option]`cpu_affinity` option allows setting CPUAffinity in
`/etc/systemd/system.conf`. This configures the CPU affinity for the `/etc/systemd/system.conf.d/00-tuned.conf`. This configures the CPU
service manager as well as the default CPU affinity for all forked affinity for the service manager as well as the default CPU affinity
off processes. The option takes a comma-separated list of CPUs with for all forked off processes. The option takes a comma-separated
optional CPU ranges specified by the minus sign (`-`). list of CPUs with optional CPU ranges specified by the minus sign (`-`).
.Set the CPUAffinity for `systemd` to `0 1 2 3` .Set the CPUAffinity for `systemd` to `0 1 2 3`
==== ====
@ -32,10 +32,15 @@ class SystemdPlugin(base.Plugin):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if not os.path.isfile(consts.SYSTEMD_SYSTEM_CONF_FILE):
raise exceptions.NotSupportedPluginException("Required systemd '%s' configuration file not found, disabling plugin." % consts.SYSTEMD_SYSTEM_CONF_FILE)
super(SystemdPlugin, self).__init__(*args, **kwargs)
self._cmd = commands() self._cmd = commands()
if not os.path.isfile(consts.SYSTEMD_SYSTEM_CONF_FILE):
if os.path.isdir(consts.SYSTEMD_CFG_PATH):
log.info("Systemd configuration file '%s' not found, attempting to create it." % consts.SYSTEMD_SYSTEM_CONF_FILE)
if not self._cmd.write_to_file(consts.SYSTEMD_SYSTEM_CONF_FILE, consts.SYSTEMD_SYSTEM_CONF_HEADER + "\n", makedir=True):
raise exceptions.NotSupportedPluginException("Error creating systemd configuration file '%s', disabling plugin." % consts.SYSTEMD_SYSTEM_CONF_FILE)
else:
raise exceptions.NotSupportedPluginException("Systemd directory '%s' not found, systemd is not probably used, disabling plugin." % consts.SYSTEMD_CFG_PATH)
super(SystemdPlugin, self).__init__(*args, **kwargs)
def _instance_init(self, instance): def _instance_init(self, instance):
instance._has_dynamic_tuning = False instance._has_dynamic_tuning = False
@ -143,4 +148,3 @@ class SystemdPlugin(base.Plugin):
self._write_systemd_system_conf(self._add_keyval(conf, consts.SYSTEMD_CPUAFFINITY_VAR, v_unpacked)) self._write_systemd_system_conf(self._add_keyval(conf, consts.SYSTEMD_CPUAFFINITY_VAR, v_unpacked))
return True return True
return None return None