tuned: fixed profile switching in no_daemon mode
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
5b9cf627f1
commit
209bd3291c
2 changed files with 9 additions and 3 deletions
8
tuned.py
8
tuned.py
|
|
@ -28,6 +28,7 @@ import tuned.daemon
|
|||
import tuned.exceptions
|
||||
import tuned.consts as consts
|
||||
import tuned.version as ver
|
||||
from tuned.utils.global_config import GlobalConfig
|
||||
|
||||
def error(message):
|
||||
print >>sys.stderr, message
|
||||
|
|
@ -47,6 +48,7 @@ if __name__ == "__main__":
|
|||
error("Superuser permissions are required to run the daemon.")
|
||||
sys.exit(1)
|
||||
|
||||
config = GlobalConfig()
|
||||
log = tuned.logs.get()
|
||||
if args.debug:
|
||||
log.setLevel("DEBUG")
|
||||
|
|
@ -60,7 +62,11 @@ if __name__ == "__main__":
|
|||
if args.log is not None:
|
||||
log.switch_to_file(args.log)
|
||||
|
||||
app = tuned.daemon.Application(args.profile)
|
||||
app = tuned.daemon.Application(args.profile, config)
|
||||
|
||||
# no daemon mode doesn't need DBus
|
||||
if not config.get_bool(consts.CFG_DAEMON, consts.CFG_DEF_DAEMON):
|
||||
args.no_dbus = True
|
||||
|
||||
if not args.no_dbus:
|
||||
app.attach_to_dbus(consts.DBUS_BUS, consts.DBUS_OBJECT, consts.DBUS_INTERFACE)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ log = tuned.logs.get()
|
|||
__all__ = ["Application"]
|
||||
|
||||
class Application(object):
|
||||
def __init__(self, profile_name=None):
|
||||
def __init__(self, profile_name = None, config = None):
|
||||
self._dbus_exporter = None
|
||||
|
||||
storage_provider = storage.PickleProvider()
|
||||
|
|
@ -27,7 +27,7 @@ class Application(object):
|
|||
plugin_instance_factory = plugins.instance.Factory()
|
||||
self.variables = profiles.variables.Variables()
|
||||
|
||||
self.config = GlobalConfig()
|
||||
self.config = GlobalConfig() if config is None else config
|
||||
if self.config.get_bool(consts.CFG_DYNAMIC_TUNING):
|
||||
log.info("dynamic tuning is enabled (can be overriden in plugins)")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue