From 51464ba1ae4b692fd9f09f92937f526ffcfcdb77 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 12 Oct 2017 13:16:01 -0600 Subject: [PATCH] DaemonGroup: Avoid using systemd by default To use systemd, any tasks which create a DaemonGroup object must pass use_systemd=True. This could be accomplished by looking for a flag in the job config. Note that this option is mainly for regression testing; it may be removed in the future, where the default is to use systemd when possible. Signed-off-by: Zack Cerza --- teuthology/orchestra/daemon/group.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/teuthology/orchestra/daemon/group.py b/teuthology/orchestra/daemon/group.py index 473ce0d93e..1e2ee9c9fb 100644 --- a/teuthology/orchestra/daemon/group.py +++ b/teuthology/orchestra/daemon/group.py @@ -7,12 +7,17 @@ class DaemonGroup(object): """ Collection of daemon state instances """ - def __init__(self): + def __init__(self, use_systemd=False): """ self.daemons is a dictionary indexed by role. Each entry is a dictionary of DaemonState values indexed by an id parameter. + + :param use_systemd: Whether or not to use systemd when appropriate + (default: False) Note: This option may be removed + in the future. """ self.daemons = {} + self.use_systemd = use_systemd def add_daemon(self, remote, type_, id_, *args, **kwargs): """ @@ -56,7 +61,8 @@ class DaemonGroup(object): if remote.init_system == 'systemd': # We currently cannot use systemd and valgrind together because # it would require rewriting the unit files - if not any(map(lambda i: i == 'valgrind', args)): + if self.use_systemd and \ + not any(map(lambda i: i == 'valgrind', args)): klass = SystemDState self.daemons[role][id_] = klass( remote, role, id_, *args, **kwargs) -- 2.39.5