2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Set up client keyring
|
|
|
|
"""
|
2013-03-21 23:14:54 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from teuthology import misc as teuthology
|
2014-08-07 14:24:59 +00:00
|
|
|
from teuthology.orchestra import run
|
2013-03-21 23:14:54 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2016-03-17 02:05:20 +00:00
|
|
|
def create_keyring(ctx, cluster_name):
|
2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
Set up key ring on remote sites
|
|
|
|
"""
|
2013-03-21 23:14:54 +00:00
|
|
|
log.info('Setting up client nodes...')
|
2016-03-17 02:05:20 +00:00
|
|
|
clients = ctx.cluster.only(teuthology.is_type('client', cluster_name))
|
2013-03-21 23:14:54 +00:00
|
|
|
testdir = teuthology.get_testdir(ctx)
|
|
|
|
coverage_dir = '{tdir}/archive/coverage'.format(tdir=testdir)
|
|
|
|
for remote, roles_for_host in clients.remotes.iteritems():
|
2016-03-17 02:05:20 +00:00
|
|
|
for role in teuthology.cluster_roles_of_type(roles_for_host, 'client',
|
|
|
|
cluster_name):
|
|
|
|
name = teuthology.ceph_role(role)
|
|
|
|
client_keyring = '/etc/ceph/{0}.{1}.keyring'.format(cluster_name, name)
|
2013-03-21 23:14:54 +00:00
|
|
|
remote.run(
|
|
|
|
args=[
|
2013-09-05 21:41:27 +00:00
|
|
|
'sudo',
|
2013-09-06 20:08:01 +00:00
|
|
|
'adjust-ulimits',
|
2013-03-21 23:14:54 +00:00
|
|
|
'ceph-coverage',
|
|
|
|
coverage_dir,
|
|
|
|
'ceph-authtool',
|
|
|
|
'--create-keyring',
|
|
|
|
'--gen-key',
|
|
|
|
# TODO this --name= is not really obeyed, all unknown "types" are munged to "client"
|
2016-03-17 02:05:20 +00:00
|
|
|
'--name={name}'.format(name=name),
|
2013-03-21 23:14:54 +00:00
|
|
|
client_keyring,
|
|
|
|
run.Raw('&&'),
|
|
|
|
'sudo',
|
|
|
|
'chmod',
|
|
|
|
'0644',
|
|
|
|
client_keyring,
|
|
|
|
],
|
|
|
|
)
|