]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph: adapt to cluster-aware daemon.resolve_role_list
authorJosh Durgin <jdurgin@redhat.com>
Wed, 16 Mar 2016 05:54:08 +0000 (22:54 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Fri, 20 May 2016 18:08:51 +0000 (11:08 -0700)
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
(cherry picked from commit e19e9e2fa31bd544894b3e36ade7c09ed8af73d6)

tasks/ceph.py

index be92c7a9af08574f823ecd036723c7d0d28ea93e..27c383cc461330bc71cc18b76586da31f9a14738 100644 (file)
@@ -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