From 2bcf6fe1133042dfdfae12d2d299a9348467ab62 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 17 Mar 2017 15:46:22 -0400 Subject: [PATCH] orchestra/daemon: separate register_daemon from add_daemon The former registers without starting; the latter does both (as before). Signed-off-by: Sage Weil --- teuthology/orchestra/daemon.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/teuthology/orchestra/daemon.py b/teuthology/orchestra/daemon.py index 3c40aaa5d4..acbdf70e35 100644 --- a/teuthology/orchestra/daemon.py +++ b/teuthology/orchestra/daemon.py @@ -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'): """ -- 2.39.5