systemd: do not backup the drop-in configuration
Resolves: RHEL-84365
This commit is contained in:
parent
eb86a14dd6
commit
47395d84fb
3 changed files with 6 additions and 16 deletions
|
|
@ -1 +1,3 @@
|
|||
# Please avoid changing this file, as it will
|
||||
# be overwritten by TuneD!
|
||||
[Manager]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue