diff --git a/00-tuned.conf.systemd b/00-tuned.conf.systemd index 26bca3d..59233cc 100644 --- a/00-tuned.conf.systemd +++ b/00-tuned.conf.systemd @@ -1 +1,3 @@ +# Please avoid changing this file, as it will +# be overwritten by TuneD! [Manager] diff --git a/tuned/consts.py b/tuned/consts.py index ba16f59..abed0cc 100644 --- a/tuned/consts.py +++ b/tuned/consts.py @@ -69,7 +69,7 @@ MODULES_FILE = "/etc/modprobe.d/tuned.conf" # systemd plugin configuration SYSTEMD_SYSTEM_CONF_FILE = SYSTEMD_CFG_PATH + "/system.conf.d/00-tuned.conf" -SYSTEMD_SYSTEM_CONF_HEADER = "[Manager]" +SYSTEMD_SYSTEM_CONF_HEADER = "# Please avoid changing this file, as it will\n# be overwritten by TuneD!\n[Manager]" SYSTEMD_CPUAFFINITY_VAR = "CPUAffinity" # irqbalance plugin configuration diff --git a/tuned/plugins/plugin_systemd.py b/tuned/plugins/plugin_systemd.py index 478b3b0..9e8cffc 100644 --- a/tuned/plugins/plugin_systemd.py +++ b/tuned/plugins/plugin_systemd.py @@ -19,6 +19,8 @@ class SystemdPlugin(base.Plugin): affinity for the service manager as well as the default CPU affinity for all forked off processes. The option takes a comma-separated list of CPUs with optional CPU ranges specified by the minus sign (`-`). + Please avoid changing the drop-in configuration file, as it is not + backed up and will be overwritten. .Set the CPUAffinity for `systemd` to `0 1 2 3` ==== @@ -99,19 +101,10 @@ class SystemdPlugin(base.Plugin): return False return True - def _get_storage_filename(self): - return os.path.join(consts.PERSISTENT_STORAGE_DIR, self.name) - def _remove_systemd_tuning(self): conf = self._read_systemd_system_conf() if (conf is not None): - fname = self._get_storage_filename() - cpu_affinity_saved = self._cmd.read_file(fname, err_ret = None, no_error = True) - self._cmd.unlink(fname) - if cpu_affinity_saved is None: - conf = self._del_key(conf, consts.SYSTEMD_CPUAFFINITY_VAR) - else: - conf = self._add_keyval(conf, consts.SYSTEMD_CPUAFFINITY_VAR, cpu_affinity_saved) + conf = self._del_key(conf, consts.SYSTEMD_CPUAFFINITY_VAR) self._write_systemd_system_conf(conf) def _instance_unapply_static(self, instance, rollback = consts.ROLLBACK_SOFT): @@ -139,11 +132,6 @@ class SystemdPlugin(base.Plugin): if verify: return self._verify_value("cpu_affinity", v_unpacked, conf_affinity_unpacked, ignore_missing) if enabling: - fname = self._get_storage_filename() - cpu_affinity_saved = self._cmd.read_file(fname, err_ret = None, no_error = True) - if conf_affinity is not None and cpu_affinity_saved is None and v_unpacked != conf_affinity_unpacked: - self._cmd.write_to_file(fname, conf_affinity, makedir = True) - log.info("setting '%s' to '%s' in the '%s'" % (consts.SYSTEMD_CPUAFFINITY_VAR, v_unpacked, consts.SYSTEMD_SYSTEM_CONF_FILE)) self._write_systemd_system_conf(self._add_keyval(conf, consts.SYSTEMD_CPUAFFINITY_VAR, v_unpacked)) return True