From: John Spray Date: Tue, 27 Sep 2016 11:17:22 +0000 (+0100) Subject: tasks/ceph: move generate_caps from teuthology X-Git-Tag: v0.94.10~27^2^2~7^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c27626c1e5d9989ac6942a94b6d9198ccbd28fb;p=ceph.git tasks/ceph: move generate_caps from teuthology 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 (cherry picked from commit 298cc8f932a2a327e07f5b73708404588a611322) --- diff --git a/tasks/ceph.py b/tasks/ceph.py index 24f28b578ad8..466cd17d9d10 100644 --- a/tasks/ceph.py +++ b/tasks/ceph.py @@ -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, ), )