]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/ceph: move generate_caps from teuthology
authorJohn Spray <john.spray@redhat.com>
Tue, 27 Sep 2016 11:17:22 +0000 (12:17 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 19 Oct 2016 12:10:28 +0000 (13:10 +0100)
This was only used in this task, and it is much too
ceph-specific to belong in teuthology.

Fixes: http://tracker.ceph.com/issues/17614
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 298cc8f932a2a327e07f5b73708404588a611322)

tasks/ceph.py

index 24f28b578ad896d4c64bb02beeaeb6713236336f..466cd17d9d10ad2ae631c5411afca43805284bb5 100644 (file)
@@ -25,6 +25,34 @@ CEPH_ROLE_TYPES = ['mon', 'osd', 'mds', 'rgw']
 log = logging.getLogger(__name__)
 
 
+def generate_caps(type_):
+    """
+    Each call will return the next capability for each system type
+    (essentially a subset of possible role values).  Valid types are osd,
+    mds and client.
+    """
+    defaults = dict(
+        osd=dict(
+            mon='allow *',
+            osd='allow *',
+        ),
+        mds=dict(
+            mon='allow *',
+            osd='allow *',
+            mds='allow',
+        ),
+        client=dict(
+            mon='allow rw',
+            osd='allow rwx',
+            mds='allow',
+        ),
+    )
+    for subsystem, capability in defaults[type_].items():
+        yield '--cap'
+        yield subsystem
+        yield capability
+
+
 @contextlib.contextmanager
 def ceph_log(ctx, config):
     """
@@ -643,7 +671,7 @@ def cluster(ctx, config):
                              type=type_,
                              id=id_,
                          ),
-                     ] + list(teuthology.generate_caps(type_)),
+                     ] + list(generate_caps(type_)),
                 wait=False,
             ),
         )