Merge pull request #270 from yarda/arch-preset
Allow override of detected architecture
This commit is contained in:
commit
f3d0605b5b
4 changed files with 24 additions and 6 deletions
|
|
@ -39,3 +39,13 @@ log_file_count = 2
|
|||
|
||||
# Log file max size
|
||||
log_file_max_size = 1MB
|
||||
|
||||
# Preset system uname string for architecture specific tuning.
|
||||
# It can be used to force tuning for specific architecture.
|
||||
# If commented, "uname" will be called to fill its content.
|
||||
# uname_string = x86_64
|
||||
|
||||
# Preset system cpuinfo string for architecture specific tuning.
|
||||
# It can be used to force tuning for specific architecture.
|
||||
# If commented, "/proc/cpuinfo" will be read to fill its content.
|
||||
# cpuinfo_string = Intel
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ CFG_RECOMMEND_COMMAND = "recommend_command"
|
|||
CFG_REAPPLY_SYSCTL = "reapply_sysctl"
|
||||
CFG_DEFAULT_INSTANCE_PRIORITY = "default_instance_priority"
|
||||
CFG_UDEV_BUFFER_SIZE = "udev_buffer_size"
|
||||
CFG_UNAME_STRING = "uname_string"
|
||||
CFG_CPUINFO_STRING = "cpuinfo_string"
|
||||
|
||||
# no_daemon mode
|
||||
CFG_DEF_DAEMON = True
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Application(object):
|
|||
def_instance_priority = int(self.config.get(consts.CFG_DEFAULT_INSTANCE_PRIORITY, consts.CFG_DEF_DEFAULT_INSTANCE_PRIORITY))
|
||||
unit_manager = units.Manager(
|
||||
plugins_repository, monitors_repository,
|
||||
def_instance_priority, hardware_inventory)
|
||||
def_instance_priority, hardware_inventory, self.config)
|
||||
|
||||
profile_factory = profiles.Factory()
|
||||
profile_merger = profiles.Merger()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import tuned.exceptions
|
|||
import tuned.logs
|
||||
import tuned.plugins.exceptions
|
||||
import tuned.consts as consts
|
||||
from tuned.utils.global_config import GlobalConfig
|
||||
from tuned.utils.commands import commands
|
||||
|
||||
log = tuned.logs.get()
|
||||
|
|
@ -18,7 +19,7 @@ class Manager(object):
|
|||
"""
|
||||
|
||||
def __init__(self, plugins_repository, monitors_repository,
|
||||
def_instance_priority, hardware_inventory):
|
||||
def_instance_priority, hardware_inventory, config = None):
|
||||
super(Manager, self).__init__()
|
||||
self._plugins_repository = plugins_repository
|
||||
self._monitors_repository = monitors_repository
|
||||
|
|
@ -26,6 +27,7 @@ class Manager(object):
|
|||
self._hardware_inventory = hardware_inventory
|
||||
self._instances = []
|
||||
self._plugins = []
|
||||
self._config = config or GlobalConfig()
|
||||
self._cmd = commands()
|
||||
|
||||
@property
|
||||
|
|
@ -43,15 +45,19 @@ class Manager(object):
|
|||
def _unit_matches_cpuinfo(self, unit):
|
||||
if unit.cpuinfo_regex is None:
|
||||
return True
|
||||
return re.search(unit.cpuinfo_regex,
|
||||
self._cmd.read_file("/proc/cpuinfo"),
|
||||
cpuinfo_string = self._config.get(consts.CFG_CPUINFO_STRING)
|
||||
if cpuinfo_string is None:
|
||||
cpuinfo_string = self._cmd.read_file("/proc/cpuinfo")
|
||||
return re.search(unit.cpuinfo_regex, cpuinfo_string,
|
||||
re.MULTILINE) is not None
|
||||
|
||||
def _unit_matches_uname(self, unit):
|
||||
if unit.uname_regex is None:
|
||||
return True
|
||||
return re.search(unit.uname_regex,
|
||||
" ".join(os.uname()),
|
||||
uname_string = self._config.get(consts.CFG_UNAME_STRING)
|
||||
if uname_string is None:
|
||||
uname_string = " ".join(os.uname())
|
||||
return re.search(unit.uname_regex, uname_string,
|
||||
re.MULTILINE) is not None
|
||||
|
||||
def create(self, instances_config):
|
||||
|
|
|
|||
Loading…
Reference in a new issue