]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra/daemon: separate register_daemon from add_daemon 1047/head
authorSage Weil <sage@redhat.com>
Fri, 17 Mar 2017 19:46:22 +0000 (15:46 -0400)
committerSage Weil <sage@redhat.com>
Fri, 17 Mar 2017 19:46:22 +0000 (15:46 -0400)
The former registers without starting; the latter does both (as before).

Signed-off-by: Sage Weil <sage@redhat.com>
teuthology/orchestra/daemon.py

index 3c40aaa5d4840512541f059e2ab1f3d98387d6d9..acbdf70e358427e283173a6ee370bebe57f35407 100644 (file)
@@ -150,7 +150,25 @@ class DaemonGroup(object):
     def add_daemon(self, remote, type_, id_, *args, **kwargs):
         """
         Add a daemon.  If there already is a daemon for this id_ and role, stop
-        that daemon and.  Restart the damon once the new value is set.
+        that daemon.  (Re)start the daemon once the new value is set.
+
+        :param remote: Remote site
+        :param type_: type of daemon (osd, mds, mon, rgw,  for example)
+        :param id_: Id (index into role dictionary)
+        :param args: Daemonstate positional parameters
+        :param kwargs: Daemonstate keyword parameters
+        """
+        # for backwards compatibility with older ceph-qa-suite branches,
+        # we can only get optional args from unused kwargs entries
+        self.register_daemon(remote, type_, id_, *args, **kwargs)
+        cluster = kwargs.pop('cluster', 'ceph')
+        role = cluster + '.' + type_
+        self.daemons[role][id_].restart()
+
+    def register_daemon(self, remote, type_, id_, *args, **kwargs):
+        """
+        Add a daemon.  If there already is a daemon for this id_ and role, stop
+        that daemon.
 
         :param remote: Remote site
         :param type_: type of daemon (osd, mds, mon, rgw,  for example)
@@ -169,7 +187,6 @@ class DaemonGroup(object):
             self.daemons[role][id_] = None
         self.daemons[role][id_] = DaemonState(remote, role, id_, *args,
                                               **kwargs)
-        self.daemons[role][id_].restart()
 
     def get_daemon(self, type_, id_, cluster='ceph'):
         """