]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
DaemonGroup: Avoid using systemd by default 934/head
authorZack Cerza <zack@redhat.com>
Thu, 12 Oct 2017 19:16:01 +0000 (13:16 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 12 Oct 2017 19:42:25 +0000 (13:42 -0600)
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 <zack@redhat.com>
teuthology/orchestra/daemon/group.py

index 473ce0d93e26ed50a839af531bba339d3fcef046..1e2ee9c9fbe2d51ffc8240eeec6c0ebd6ef8ba84 100644 (file)
@@ -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)