plugin_net: do not read monitors if dynamic tuning is disabled
Resolves: RHEL-28757 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
86ac977798
commit
88b1b45649
5 changed files with 36 additions and 26 deletions
|
|
@ -263,6 +263,7 @@ class Plugin(object):
|
|||
self._call_device_script(instance, instance.script_post,
|
||||
"apply", instance.assigned_devices)
|
||||
if instance.has_dynamic_tuning and self._global_cfg.get(consts.CFG_DYNAMIC_TUNING, consts.CFG_DEF_DYNAMIC_TUNING):
|
||||
self._instance_init_dynamic(instance)
|
||||
self._run_for_each_device(instance, self._instance_apply_dynamic, instance.assigned_devices)
|
||||
instance.processed_devices.update(instance.assigned_devices)
|
||||
instance.assigned_devices.clear()
|
||||
|
|
@ -333,6 +334,9 @@ class Plugin(object):
|
|||
instance.processed_devices)
|
||||
self._cleanup_all_non_device_commands(instance)
|
||||
|
||||
def _instance_init_dynamic(self, instance):
|
||||
pass
|
||||
|
||||
def _instance_apply_dynamic(self, instance, device):
|
||||
for option in [opt for opt in self._options_used_by_dynamic if self._storage_get(instance, self._commands[opt], device) is None]:
|
||||
self._check_and_save_value(instance, self._commands[option], device)
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ class CPULatencyPlugin(hotplug.Plugin):
|
|||
def _instance_init(self, instance):
|
||||
instance._has_static_tuning = True
|
||||
instance._has_dynamic_tuning = False
|
||||
instance._load_monitor = None
|
||||
|
||||
# only the first instance of the plugin can control the latency
|
||||
if list(self._instances.values())[0] == instance:
|
||||
|
|
@ -329,10 +330,7 @@ class CPULatencyPlugin(hotplug.Plugin):
|
|||
self._latency = None
|
||||
|
||||
if instance.options["force_latency"] is None and instance.options["pm_qos_resume_latency_us"] is None:
|
||||
instance._load_monitor = self._monitors_repository.create("load", None)
|
||||
instance._has_dynamic_tuning = True
|
||||
else:
|
||||
instance._load_monitor = None
|
||||
|
||||
self._check_arch()
|
||||
else:
|
||||
|
|
@ -351,6 +349,11 @@ class CPULatencyPlugin(hotplug.Plugin):
|
|||
if instance._load_monitor is not None:
|
||||
self._monitors_repository.delete(instance._load_monitor)
|
||||
|
||||
def _instance_init_dynamic(self, instance):
|
||||
super(CPULatencyPlugin, self)._instance_init_dynamic(instance)
|
||||
if instance._first_instance:
|
||||
instance._load_monitor = self._monitors_repository.create("load", None)
|
||||
|
||||
def _get_intel_pstate_attr(self, attr):
|
||||
return self._cmd.read_file("/sys/devices/system/cpu/intel_pstate/%s" % attr, None).strip()
|
||||
|
||||
|
|
|
|||
|
|
@ -180,24 +180,23 @@ class DiskPlugin(hotplug.Plugin):
|
|||
self._apm_errcnt = 0
|
||||
self._spindown_errcnt = 0
|
||||
|
||||
if self._option_bool(instance.options["dynamic"]):
|
||||
instance._has_dynamic_tuning = True
|
||||
instance._load_monitor = \
|
||||
self._monitors_repository.create(
|
||||
"disk", instance.assigned_devices)
|
||||
instance._device_idle = {}
|
||||
instance._stats = {}
|
||||
instance._idle = {}
|
||||
instance._spindown_change_delayed = {}
|
||||
else:
|
||||
instance._has_dynamic_tuning = False
|
||||
instance._load_monitor = None
|
||||
instance._load_monitor = None
|
||||
instance._has_dynamic_tuning = self._option_bool(instance.options["dynamic"])
|
||||
|
||||
def _instance_cleanup(self, instance):
|
||||
if instance._load_monitor is not None:
|
||||
self._monitors_repository.delete(instance._load_monitor)
|
||||
instance._load_monitor = None
|
||||
|
||||
def _instance_init_dynamic(self, instance):
|
||||
super(DiskPlugin, self)._instance_init_dynamic(instance)
|
||||
instance._device_idle = {}
|
||||
instance._stats = {}
|
||||
instance._idle = {}
|
||||
instance._spindown_change_delayed = {}
|
||||
instance._load_monitor = self._monitors_repository.create(
|
||||
"disk", instance.assigned_devices)
|
||||
|
||||
def _update_errcnt(self, rc, spindown):
|
||||
if spindown:
|
||||
s = "spindown"
|
||||
|
|
|
|||
|
|
@ -49,13 +49,17 @@ class EeePCSHEPlugin(base.Plugin):
|
|||
instance._has_static_tuning = False
|
||||
instance._has_dynamic_tuning = True
|
||||
instance._she_mode = None
|
||||
instance._load_monitor = self._monitors_repository.create("load", None)
|
||||
instance._load_monitor = None
|
||||
|
||||
def _instance_cleanup(self, instance):
|
||||
if instance._load_monitor is not None:
|
||||
self._monitors_repository.delete(instance._load_monitor)
|
||||
instance._load_monitor = None
|
||||
|
||||
def _instance_init_dynamic(self, instance):
|
||||
super(EeePCSHEPlugin, self)._instance_init_dynamic(instance)
|
||||
instance._load_monitor = self._monitors_repository.create("load", None)
|
||||
|
||||
def _instance_update_dynamic(self, instance, device):
|
||||
load = instance._load_monitor.get_load()["system"]
|
||||
if load <= instance.options["load_threshold_powersave"]:
|
||||
|
|
|
|||
|
|
@ -176,22 +176,22 @@ class NetTuningPlugin(hotplug.Plugin):
|
|||
|
||||
def _instance_init(self, instance):
|
||||
instance._has_static_tuning = True
|
||||
if self._option_bool(instance.options["dynamic"]):
|
||||
instance._has_dynamic_tuning = True
|
||||
instance._load_monitor = self._monitors_repository.create("net", instance.assigned_devices)
|
||||
instance._idle = {}
|
||||
instance._stats = {}
|
||||
else:
|
||||
instance._has_dynamic_tuning = False
|
||||
instance._load_monitor = None
|
||||
instance._idle = None
|
||||
instance._stats = None
|
||||
instance._load_monitor = None
|
||||
instance._idle = None
|
||||
instance._stats = None
|
||||
instance._has_dynamic_tuning = self._option_bool(instance.options["dynamic"])
|
||||
|
||||
def _instance_cleanup(self, instance):
|
||||
if instance._load_monitor is not None:
|
||||
self._monitors_repository.delete(instance._load_monitor)
|
||||
instance._load_monitor = None
|
||||
|
||||
def _instance_init_dynamic(self, instance):
|
||||
super(NetTuningPlugin, self)._instance_init_dynamic(instance)
|
||||
instance._idle = {}
|
||||
instance._stats = {}
|
||||
instance._load_monitor = self._monitors_repository.create("net", instance.assigned_devices)
|
||||
|
||||
def _instance_apply_dynamic(self, instance, device):
|
||||
self._instance_update_dynamic(instance, device)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue