From d17659d1c8b74086c5da930d24339bc5b55b86fb Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 15 Mar 2016 22:54:08 -0700 Subject: [PATCH] tasks/ceph: adapt to cluster-aware daemon.resolve_role_list Signed-off-by: Josh Durgin (cherry picked from commit e19e9e2fa31bd544894b3e36ade7c09ed8af73d6) --- tasks/ceph.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tasks/ceph.py b/tasks/ceph.py index be92c7a9af085..27c383cc46133 100644 --- a/tasks/ceph.py +++ b/tasks/ceph.py @@ -1196,11 +1196,10 @@ def restart(ctx, config): elif isinstance(config, list): config = {'daemons': config} - daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES) - for i in daemons: - type_ = i.split('.', 1)[0] - id_ = i.split('.', 1)[1] - ctx.daemons.get_daemon(type_, id_).restart() + daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES, True) + for role in daemons: + cluster, type_, id_ = teuthology.split_role(role) + ctx.daemons.get_daemon(type_, id_, cluster).restart() if config.get('wait-for-healthy', True): healthy(ctx=ctx, config=None) @@ -1231,11 +1230,10 @@ def stop(ctx, config): elif isinstance(config, list): config = {'daemons': config} - daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES) - for i in daemons: - type_ = i.split('.', 1)[0] - id_ = i.split('.', 1)[1] - ctx.daemons.get_daemon(type_, id_).stop() + daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES, True) + for role in daemons: + cluster, type_, id_ = teuthology.split_role(role) + ctx.daemons.get_daemon(type_, id_, cluster).stop() yield @@ -1262,17 +1260,16 @@ def wait_for_failure(ctx, config): elif isinstance(config, list): config = {'daemons': config} - daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES) - for i in daemons: - type_ = i.split('.', 1)[0] - id_ = i.split('.', 1)[1] + daemons = ctx.daemons.resolve_role_list(config.get('daemons', None), CEPH_ROLE_TYPES, True) + for role in daemons: + cluster, type_, id_ = teuthology.split_role(role) try: - ctx.daemons.get_daemon(type_, id_).wait() + ctx.daemons.get_daemon(type_, id_, cluster).wait() except: log.info('Saw expected daemon failure. Continuing.') pass else: - raise RuntimeError('daemon %s did not fail' % i) + raise RuntimeError('daemon %s did not fail' % role) yield -- 2.39.5