diff --git a/Makefile b/Makefile index f73f572f..9cee151f 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,11 @@ $(error Failed to determine python library directory) endif KERNELINSTALLHOOKDIR = /usr/lib/kernel/install.d TUNED_SYSTEM_DIR = /usr/lib/tuned -TUNED_PROFILES_DIR = $(TUNED_SYSTEM_DIR)/profiles +TUNED_SYSTEM_PROFILES_DIR = $(TUNED_SYSTEM_DIR)/profiles +TUNED_CFG_DIR = $(SYSCONFDIR)/tuned +TUNED_USER_PROFILES_DIR = $(TUNED_CFG_DIR)/profiles TUNED_RECOMMEND_DIR = $(TUNED_SYSTEM_DIR)/recommend.d -TUNED_USER_RECOMMEND_DIR = $(SYSCONFDIR)/tuned/recommend.d +TUNED_USER_RECOMMEND_DIR = $(TUNED_CFG_DIR)/recommend.d BASH_COMPLETIONS = $(DATADIR)/bash-completion/completions copy_executable = install -Dm 0755 $(1) $(2) @@ -129,13 +131,13 @@ clean-html: install-dirs: mkdir -p $(DESTDIR)$(PYTHON_SITELIB) - mkdir -p $(DESTDIR)$(TUNED_PROFILES_DIR) + mkdir -p $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR) mkdir -p $(DESTDIR)/var/lib/tuned mkdir -p $(DESTDIR)/var/log/tuned mkdir -p $(DESTDIR)/run/tuned mkdir -p $(DESTDIR)$(DOCDIR) mkdir -p $(DESTDIR)$(SYSCONFDIR) - mkdir -p $(DESTDIR)$(SYSCONFDIR)/tuned/profiles + mkdir -p $(DESTDIR)$(TUNED_USER_PROFILES_DIR) mkdir -p $(DESTDIR)$(TUNED_RECOMMEND_DIR) mkdir -p $(DESTDIR)$(TUNED_USER_RECOMMEND_DIR) @@ -161,26 +163,36 @@ install: install-dirs experiments/powertop2tuned.py, $(DESTDIR)/usr/bin/powertop2tuned) # configuration files - install -Dpm 0644 tuned-main.conf $(DESTDIR)$(SYSCONFDIR)/tuned/tuned-main.conf + # Update profiles location + sed '/^\s*#\?\s*profile_dirs\s*=\s*/ s|\(profile_dirs\s*=\s*\).*$$|\1$(TUNED_SYSTEM_PROFILES_DIR),$(TUNED_USER_PROFILES_DIR)|' \ + tuned-main.conf > tuned-main.conf.tmp + touch -r tuned-main.conf tuned-main.conf.tmp + sed -i '/^\s*USER_PROFILES_DIR\s*=\s*/ s|\(USER_PROFILES_DIR\s*=\s*\).*$$|\1"$(TUNED_USER_PROFILES_DIR)"|' \ + $(DESTDIR)$(PYTHON_SITELIB)/tuned/consts.py + sed -i '/^\s*SYSTEM_PROFILES_DIR\s*=\s*/ s|\(SYSTEM_PROFILES_DIR\s*=\s*\).*$$|\1"$(TUNED_SYSTEM_PROFILES_DIR)"|' \ + $(DESTDIR)$(PYTHON_SITELIB)/tuned/consts.py + install -Dpm 0644 tuned-main.conf.tmp $(DESTDIR)$(TUNED_CFG_DIR)/tuned-main.conf + rm -f tuned-main.conf.tmp + # None profile in the moment, autodetection will be used - echo -n > $(DESTDIR)$(SYSCONFDIR)/tuned/active_profile - echo -n > $(DESTDIR)$(SYSCONFDIR)/tuned/profile_mode - echo -n > $(DESTDIR)$(SYSCONFDIR)/tuned/post_loaded_profile - install -Dpm 0644 bootcmdline $(DESTDIR)$(SYSCONFDIR)/tuned/bootcmdline + echo -n > $(DESTDIR)$(TUNED_CFG_DIR)/active_profile + echo -n > $(DESTDIR)$(TUNED_CFG_DIR)/profile_mode + echo -n > $(DESTDIR)$(TUNED_CFG_DIR)/post_loaded_profile + install -Dpm 0644 bootcmdline $(DESTDIR)$(TUNED_CFG_DIR)/bootcmdline install -Dpm 0644 modules.conf $(DESTDIR)$(SYSCONFDIR)/modprobe.d/tuned.conf # profiles & system config - cp -a profiles/* $(DESTDIR)$(TUNED_PROFILES_DIR)/ - mv $(DESTDIR)$(TUNED_PROFILES_DIR)/realtime/realtime-variables.conf \ - $(DESTDIR)$(SYSCONFDIR)/tuned/realtime-variables.conf - mv $(DESTDIR)$(TUNED_PROFILES_DIR)/realtime-virtual-guest/realtime-virtual-guest-variables.conf \ - $(DESTDIR)$(SYSCONFDIR)/tuned/realtime-virtual-guest-variables.conf - mv $(DESTDIR)$(TUNED_PROFILES_DIR)/realtime-virtual-host/realtime-virtual-host-variables.conf \ - $(DESTDIR)$(SYSCONFDIR)/tuned/realtime-virtual-host-variables.conf - mv $(DESTDIR)$(TUNED_PROFILES_DIR)/cpu-partitioning/cpu-partitioning-variables.conf \ - $(DESTDIR)$(SYSCONFDIR)/tuned/cpu-partitioning-variables.conf - mv $(DESTDIR)$(TUNED_PROFILES_DIR)/cpu-partitioning-powersave/cpu-partitioning-powersave-variables.conf \ - $(DESTDIR)$(SYSCONFDIR)/tuned/cpu-partitioning-powersave-variables.conf + cp -a profiles/* $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/ + mv $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/realtime/realtime-variables.conf \ + $(DESTDIR)$(TUNED_CFG_DIR)/realtime-variables.conf + mv $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/realtime-virtual-guest/realtime-virtual-guest-variables.conf \ + $(DESTDIR)$(TUNED_CFG_DIR)/realtime-virtual-guest-variables.conf + mv $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/realtime-virtual-host/realtime-virtual-host-variables.conf \ + $(DESTDIR)$(TUNED_CFG_DIR)/realtime-virtual-host-variables.conf + mv $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/cpu-partitioning/cpu-partitioning-variables.conf \ + $(DESTDIR)$(TUNED_CFG_DIR)/cpu-partitioning-variables.conf + mv $(DESTDIR)$(TUNED_SYSTEM_PROFILES_DIR)/cpu-partitioning-powersave/cpu-partitioning-powersave-variables.conf \ + $(DESTDIR)$(TUNED_CFG_DIR)/cpu-partitioning-powersave-variables.conf install -pm 0644 recommend.conf $(DESTDIR)$(TUNED_RECOMMEND_DIR)/50-tuned.conf # bash functions used by profile scripts @@ -228,7 +240,7 @@ install: install-dirs install -dD $(DESTDIR)$(DATADIR)/applications desktop-file-install --dir=$(DESTDIR)$(DATADIR)/applications tuned-gui.desktop -install-ppd: install +install-ppd: $(call install_python_script,tuned-ppd.py,$(DESTDIR)/usr/sbin/tuned-ppd) install -Dpm 0644 tuned/ppd/tuned-ppd.service $(DESTDIR)$(UNITDIR)/tuned-ppd.service install -Dpm 0644 tuned/ppd/tuned-ppd.dbus.service $(DESTDIR)$(DATADIR)/dbus-1/system-services/net.hadess.PowerProfiles.service diff --git a/tests/beakerlib/Traceback-caused-by-scheduler-plugin-with/runtest.sh b/tests/beakerlib/Traceback-caused-by-scheduler-plugin-with/runtest.sh index d5cce712..5e3f4034 100755 --- a/tests/beakerlib/Traceback-caused-by-scheduler-plugin-with/runtest.sh +++ b/tests/beakerlib/Traceback-caused-by-scheduler-plugin-with/runtest.sh @@ -18,7 +18,6 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="tuned" -PROFILE_DIR="/etc/tuned/profiles" rlJournalStart rlPhaseStartSetup @@ -29,33 +28,36 @@ rlJournalStart rlServiceStart "tuned" rlImport "tuned/basic" tunedProfileBackup - rlFileBackup "/etc/tuned/active_profile" + rlFileBackup "/etc/tuned/active_profile" rlFileBackup "/etc/tuned/profile_mode" - rlRun "mkdir $PROFILE_DIR/test-profile" - rlServiceStart "tuned" + PROFILE_DIR=$(tunedGetProfilesBaseDir) + + rlRun "mkdir -p ${PROFILE_DIR}/test-profile" + rlServiceStop "tuned" sleep 1 - rlFileBackup "/var/log/tuned/tuned.log" - rlRun "rm -rf /var/log/tuned/tuned.log" + rlFileBackup "/var/log/tuned/tuned.log" + rlRun "rm -rf /var/log/tuned/tuned.log" + rlServiceStart "tuned" rlPhaseEnd rlPhaseStartTest - rlRun "pushd $PROFILE_DIR/test-profile" - cat << EOF > tuned.conf + rlRun "pushd $PROFILE_DIR/test-profile" + cat << EOF > tuned.conf [scheduler] runtime=0 EOF - rlRun "popd" + rlRun "popd" - rlRun "tuned-adm profile test-profile" + rlRun "tuned-adm profile test-profile" rlServiceStop "tuned" - sleep 3 + sleep 3 rlServiceStart "tuned" - sleep 3 + sleep 3 rlServiceStop "tuned" - rlAssertNotGrep "Traceback" "/var/log/tuned/tuned.log" - rlAssertNotGrep "object has no attribute '_evlist'" "/var/log/tuned/tuned.log" + rlAssertNotGrep "Traceback" "/var/log/tuned/tuned.log" + rlAssertNotGrep "object has no attribute '_evlist'" "/var/log/tuned/tuned.log" rlPhaseEnd rlPhaseStartCleanup @@ -65,10 +67,10 @@ EOF tunedProfileRestore rlServiceStop "tuned" - rlFileRestore + rlFileRestore rlServiceRestore "tuned" - rlRun "rm -rf $PROFILE_DIR/test-profile" + rlRun "rm -rf $PROFILE_DIR/test-profile" rlPhaseEnd rlJournalPrintText diff --git a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh index 4825ceb4..bc7380bd 100755 --- a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh +++ b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/runtest.sh @@ -18,11 +18,9 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="tuned" -SYSCONF_DIR=/etc/tuned -PROFILE_DIR=$SYSCONF_DIR/profiles -ACTIVE_PROFILE=$SYSCONF_DIR/active_profile -PROFILE_MODE=$SYSCONF_DIR/profile_mode -POST_LOADED_PROFILE=$SYSCONF_DIR/post_loaded_profile +ACTIVE_PROFILE=/etc/tuned/active_profile +POST_LOADED_PROFILE="/etc/tuned/post_loaded_profile" +PROFILE_MODE=/etc/tuned/profile_mode SWAPPINESS=vm.swappiness DIRTY_RATIO=vm.dirty_ratio PID_FILE=/run/tuned/tuned.pid @@ -62,10 +60,11 @@ function wait_for_tuned_stop() rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE + rlImport "tuned/basic" - tunedDisableSystemdRateLimitingStart - rlRun "for PYTHON in $PYTHON_CHECK; do \$PYTHON --version 2>/dev/null && break; done" 0 "Detect python" - rlRun "rlFileBackup --clean $SYSCONF_DIR" + PROFILE_DIR=$(tunedGetProfilesBaseDir) + + rlRun "rlFileBackup --clean $PROFILE_DIR" rlRun "cp -r parent $PROFILE_DIR" rlRun "cp -r parent2 $PROFILE_DIR" rlRun "cp -r parent-vars $PROFILE_DIR" diff --git a/tests/beakerlib/bz2071418-TuneD-exits-on-duplicate-config-lines-new/runtest.sh b/tests/beakerlib/bz2071418-TuneD-exits-on-duplicate-config-lines-new/runtest.sh index 8ecda754..9c4344df 100755 --- a/tests/beakerlib/bz2071418-TuneD-exits-on-duplicate-config-lines-new/runtest.sh +++ b/tests/beakerlib/bz2071418-TuneD-exits-on-duplicate-config-lines-new/runtest.sh @@ -18,7 +18,6 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="tuned" -PROFILE_DIR=/etc/tuned/profiles rlJournalStart rlPhaseStartSetup @@ -29,7 +28,9 @@ rlJournalStart rlServiceStart "tuned" tunedProfileBackup - rlRun "mkdir $PROFILE_DIR/test-profile" + PROFILE_DIR=$(tunedGetProfilesBaseDir) + + rlRun "mkdir -p $PROFILE_DIR/test-profile" rlRun "pushd $PROFILE_DIR/test-profile" cat << EOF > tuned.conf [sysctl] @@ -53,8 +54,8 @@ EOF rlAssertGrep "test-profile" "/etc/tuned/active_profile" - # last value from config is used - rlAssertGrep "16384$" /sys/fs/selinux/avc/cache_threshold + # last value from config is used + rlAssertGrep "16384$" /sys/fs/selinux/avc/cache_threshold rlPhaseEnd rlPhaseStartCleanup diff --git a/tests/beakerlib/error-messages/runtest.sh b/tests/beakerlib/error-messages/runtest.sh index 12f535e4..dfc97942 100755 --- a/tests/beakerlib/error-messages/runtest.sh +++ b/tests/beakerlib/error-messages/runtest.sh @@ -18,12 +18,14 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="tuned" -PROFILE_DIR="/usr/lib/tuned/profiles" rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE rlImport "tuned/basic" + + PROFILE_DIR=$(tunedGetProfilesBaseDir) + tunedDisableSystemdRateLimitingStart rlServiceStart "tuned" tunedProfileBackup diff --git a/tests/beakerlib/variables-support-in-profiles/runtest.sh b/tests/beakerlib/variables-support-in-profiles/runtest.sh index 145bd9e7..3d4495fb 100755 --- a/tests/beakerlib/variables-support-in-profiles/runtest.sh +++ b/tests/beakerlib/variables-support-in-profiles/runtest.sh @@ -18,18 +18,21 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 PACKAGE="tuned" -PROFILE_DIR="/usr/lib/tuned/profiles" rlJournalStart rlPhaseStartSetup rlAssertRpm $PACKAGE rlImport "tuned/basic" + + PROFILE_DIR=$(tunedGetProfilesBaseDir) + + rlFileBackup --clean "$PROFILE_DIR/balanced" + rlRun "mkdir -p ${PROFILE_DIR}/test-profile" + tunedDisableSystemdRateLimitingStart rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" rlRun "pushd $TmpDir" rlServiceStart "tuned" - tunedProfileBackup - rlFileBackup "$PROFILE_DIR/balanced/tuned.conf" echo " [variables] diff --git a/tuned.spec b/tuned.spec index a4884071..f1efb682 100644 --- a/tuned.spec +++ b/tuned.spec @@ -1,5 +1,13 @@ %bcond_with snapshot +%if 0%{?rhel} && 0%{?rhel} < 10 +%global user_profiles_dir %{_sysconfdir}/tuned +%global system_profiles_dir %{_prefix}/lib/tuned +%else +%global user_profiles_dir %{_sysconfdir}/tuned/profiles +%global system_profiles_dir %{_prefix}/lib/tuned/profiles +%endif + %if 0%{?fedora} %if 0%{?fedora} > 27 %bcond_without python3 @@ -7,11 +15,18 @@ %bcond_with python3 %endif %else -%if 0%{?rhel} && 0%{?rhel} < 8 + +# ! 0%%{?fedora} +%if 0%{?rhel} +%if 0%{?rhel} < 8 %bcond_with python3 %else %bcond_without python3 %endif +%else +# ! 0%%{?rhel} +%bcond_without python3 +%endif %endif %if %{with python3} @@ -286,7 +301,9 @@ make html %{make_python_arg} %endif %install -make install DESTDIR=%{buildroot} DOCDIR=%{docdir} %{make_python_arg} +make install DESTDIR=%{buildroot} DOCDIR=%{docdir} %{make_python_arg} \ + TUNED_USER_PROFILES_DIR=%{user_profiles_dir} \ + TUNED_SYSTEM_PROFILES_DIR=%{system_profiles_dir} make install-ppd DESTDIR=%{buildroot} DOCDIR=%{docdir} %{make_python_arg} %if ! 0%{?rhel} @@ -453,34 +470,38 @@ fi %exclude %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf %exclude %{_sysconfdir}/tuned/cpu-partitioning-variables.conf %exclude %{_sysconfdir}/tuned/cpu-partitioning-powersave-variables.conf -%exclude %{_prefix}/lib/tuned/profiles/default -%exclude %{_prefix}/lib/tuned/profiles/desktop-powersave -%exclude %{_prefix}/lib/tuned/profiles/laptop-ac-powersave -%exclude %{_prefix}/lib/tuned/profiles/server-powersave -%exclude %{_prefix}/lib/tuned/profiles/laptop-battery-powersave -%exclude %{_prefix}/lib/tuned/profiles/enterprise-storage -%exclude %{_prefix}/lib/tuned/profiles/spindown-disk -%exclude %{_prefix}/lib/tuned/profiles/sap-netweaver -%exclude %{_prefix}/lib/tuned/profiles/sap-hana -%exclude %{_prefix}/lib/tuned/profiles/sap-hana-kvm-guest -%exclude %{_prefix}/lib/tuned/profiles/mssql -%exclude %{_prefix}/lib/tuned/profiles/oracle -%exclude %{_prefix}/lib/tuned/profiles/atomic-host -%exclude %{_prefix}/lib/tuned/profiles/atomic-guest -%exclude %{_prefix}/lib/tuned/profiles/realtime -%exclude %{_prefix}/lib/tuned/profiles/realtime-virtual-guest -%exclude %{_prefix}/lib/tuned/profiles/realtime-virtual-host -%exclude %{_prefix}/lib/tuned/profiles/cpu-partitioning -%exclude %{_prefix}/lib/tuned/profiles/cpu-partitioning-powersave -%exclude %{_prefix}/lib/tuned/profiles/spectrumscale-ece -%exclude %{_prefix}/lib/tuned/profiles/postgresql -%exclude %{_prefix}/lib/tuned/profiles/openshift -%exclude %{_prefix}/lib/tuned/profiles/openshift-control-plane -%exclude %{_prefix}/lib/tuned/profiles/openshift-node +%exclude %{system_profiles_dir}/default +%exclude %{system_profiles_dir}/desktop-powersave +%exclude %{system_profiles_dir}/laptop-ac-powersave +%exclude %{system_profiles_dir}/server-powersave +%exclude %{system_profiles_dir}/laptop-battery-powersave +%exclude %{system_profiles_dir}/enterprise-storage +%exclude %{system_profiles_dir}/spindown-disk +%exclude %{system_profiles_dir}/sap-netweaver +%exclude %{system_profiles_dir}/sap-hana +%exclude %{system_profiles_dir}/sap-hana-kvm-guest +%exclude %{system_profiles_dir}/mssql +%exclude %{system_profiles_dir}/oracle +%exclude %{system_profiles_dir}/atomic-host +%exclude %{system_profiles_dir}/atomic-guest +%exclude %{system_profiles_dir}/realtime +%exclude %{system_profiles_dir}/realtime-virtual-guest +%exclude %{system_profiles_dir}/realtime-virtual-host +%exclude %{system_profiles_dir}/cpu-partitioning +%exclude %{system_profiles_dir}/cpu-partitioning-powersave +%exclude %{system_profiles_dir}/spectrumscale-ece +%exclude %{system_profiles_dir}/postgresql +%exclude %{system_profiles_dir}/openshift +%exclude %{system_profiles_dir}/openshift-control-plane +%exclude %{system_profiles_dir}/openshift-node %{_prefix}/lib/tuned %dir %{_sysconfdir}/tuned %dir %{_sysconfdir}/tuned/recommend.d -%dir %{_sysconfdir}/tuned/profiles + +%if "%{user_profiles_dir}" != "%{_sysconfdir}/tuned" +%dir %{user_profiles_dir} +%endif + %dir %{_libexecdir}/tuned %{_libexecdir}/tuned/defirqaffinity* %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/tuned/active_profile @@ -534,40 +555,40 @@ fi %{_mandir}/man8/scomes.* %files profiles-sap -%{_prefix}/lib/tuned/profiles/sap-netweaver +%{system_profiles_dir}/sap-netweaver %{_mandir}/man7/tuned-profiles-sap.7* %files profiles-sap-hana -%{_prefix}/lib/tuned/profiles/sap-hana -%{_prefix}/lib/tuned/profiles/sap-hana-kvm-guest +%{system_profiles_dir}/sap-hana +%{system_profiles_dir}/sap-hana-kvm-guest %{_mandir}/man7/tuned-profiles-sap-hana.7* %files profiles-mssql -%{_prefix}/lib/tuned/profiles/mssql +%{system_profiles_dir}/mssql %{_mandir}/man7/tuned-profiles-mssql.7* %files profiles-oracle -%{_prefix}/lib/tuned/profiles/oracle +%{system_profiles_dir}/oracle %{_mandir}/man7/tuned-profiles-oracle.7* %files profiles-atomic -%{_prefix}/lib/tuned/profiles/atomic-host -%{_prefix}/lib/tuned/profiles/atomic-guest +%{system_profiles_dir}/atomic-host +%{system_profiles_dir}/atomic-guest %{_mandir}/man7/tuned-profiles-atomic.7* %files profiles-realtime %config(noreplace) %{_sysconfdir}/tuned/realtime-variables.conf -%{_prefix}/lib/tuned/profiles/realtime +%{system_profiles_dir}/realtime %{_mandir}/man7/tuned-profiles-realtime.7* %files profiles-nfv-guest %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-guest-variables.conf -%{_prefix}/lib/tuned/profiles/realtime-virtual-guest +%{system_profiles_dir}/realtime-virtual-guest %{_mandir}/man7/tuned-profiles-nfv-guest.7* %files profiles-nfv-host %config(noreplace) %{_sysconfdir}/tuned/realtime-virtual-host-variables.conf -%{_prefix}/lib/tuned/profiles/realtime-virtual-host +%{system_profiles_dir}/realtime-virtual-host %{_mandir}/man7/tuned-profiles-nfv-host.7* %files profiles-nfv @@ -576,32 +597,32 @@ fi %files profiles-cpu-partitioning %config(noreplace) %{_sysconfdir}/tuned/cpu-partitioning-variables.conf %config(noreplace) %{_sysconfdir}/tuned/cpu-partitioning-powersave-variables.conf -%{_prefix}/lib/tuned/profiles/cpu-partitioning -%{_prefix}/lib/tuned/profiles/cpu-partitioning-powersave +%{system_profiles_dir}/cpu-partitioning +%{system_profiles_dir}/cpu-partitioning-powersave %{_mandir}/man7/tuned-profiles-cpu-partitioning.7* %files profiles-spectrumscale -%{_prefix}/lib/tuned/profiles/spectrumscale-ece +%{system_profiles_dir}/spectrumscale-ece %{_mandir}/man7/tuned-profiles-spectrumscale-ece.7* %files profiles-compat -%{_prefix}/lib/tuned/profiles/default -%{_prefix}/lib/tuned/profiles/desktop-powersave -%{_prefix}/lib/tuned/profiles/laptop-ac-powersave -%{_prefix}/lib/tuned/profiles/server-powersave -%{_prefix}/lib/tuned/profiles/laptop-battery-powersave -%{_prefix}/lib/tuned/profiles/enterprise-storage -%{_prefix}/lib/tuned/profiles/spindown-disk +%{system_profiles_dir}/default +%{system_profiles_dir}/desktop-powersave +%{system_profiles_dir}/laptop-ac-powersave +%{system_profiles_dir}/server-powersave +%{system_profiles_dir}/laptop-battery-powersave +%{system_profiles_dir}/enterprise-storage +%{system_profiles_dir}/spindown-disk %{_mandir}/man7/tuned-profiles-compat.7* %files profiles-postgresql -%{_prefix}/lib/tuned/profiles/postgresql +%{system_profiles_dir}/postgresql %{_mandir}/man7/tuned-profiles-postgresql.7* %files profiles-openshift -%{_prefix}/lib/tuned/profiles/openshift -%{_prefix}/lib/tuned/profiles/openshift-control-plane -%{_prefix}/lib/tuned/profiles/openshift-node +%{system_profiles_dir}/openshift +%{system_profiles_dir}/openshift-control-plane +%{system_profiles_dir}/openshift-node %{_mandir}/man7/tuned-profiles-openshift.7* %files ppd diff --git a/tuned/consts.py b/tuned/consts.py index 5134684c..912225df 100644 --- a/tuned/consts.py +++ b/tuned/consts.py @@ -13,7 +13,8 @@ DBUS_OBJECT = "/Tuned" DEFAULT_PROFILE = "balanced" DEFAULT_STORAGE_FILE = "/run/tuned/save.pickle" -SYSTEM_PROFILE_DIR = "/usr/lib/tuned/profiles" +USER_PROFILES_DIR = "/etc/tuned/profiles" +SYSTEM_PROFILES_DIR = "/usr/lib/tuned/profiles" PERSISTENT_STORAGE_DIR = "/var/lib/tuned" PLUGIN_MAIN_UNIT_NAME = "main" # Magic section header because ConfigParser does not support "headerless" config @@ -174,7 +175,7 @@ # default rollback strategy CFG_DEF_ROLLBACK = "auto" # default profile directories -CFG_DEF_PROFILE_DIRS = [SYSTEM_PROFILE_DIR, "/etc/tuned/profiles"] +CFG_DEF_PROFILE_DIRS = [SYSTEM_PROFILES_DIR, USER_PROFILES_DIR] PATH_CPU_DMA_LATENCY = "/dev/cpu_dma_latency" diff --git a/tuned/gtk/gui_profile_loader.py b/tuned/gtk/gui_profile_loader.py index 9f65ae09..414d01b6 100644 --- a/tuned/gtk/gui_profile_loader.py +++ b/tuned/gtk/gui_profile_loader.py @@ -60,7 +60,7 @@ def set_raw_profile(self, profile_name, config): profilePath = self._locate_profile_path(profile_name) - if profilePath != tuned.consts.SYSTEM_PROFILE_DIR: + if profilePath != tuned.consts.SYSTEM_PROFILES_DIR: file_path = profilePath + '/' + profile_name + '/' + tuned.consts.PROFILE_FILE config_parser = ConfigParser(delimiters=('='), inline_comment_prefixes=('#'), strict=False) config_parser.optionxform = str @@ -130,7 +130,7 @@ def save_profile(self, profile): # save the new profile to a non-system directory with the highest priority path = None for d in reversed(self.directories): - if d != tuned.consts.SYSTEM_PROFILE_DIR: + if d != tuned.consts.SYSTEM_PROFILES_DIR: path = os.path.join(d, profile.name) break if path is None: @@ -219,7 +219,7 @@ def is_profile_removable(self, profile_name): def is_profile_factory(self, profile_name): profile_path = self._locate_profile_path(profile_name) - return profile_path == tuned.consts.SYSTEM_PROFILE_DIR + return profile_path == tuned.consts.SYSTEM_PROFILES_DIR def _save_profile(self, config): ec = subprocess.call(['pkexec', sys.executable, tuned.gtk.gui_profile_saver.__file__ , json.dumps(config)])