3 from teuthology import misc as teuthology
5 log = logging.getLogger(__name__)
7 def rados(ctx, remote, cmd, wait=True, check_status=False):
8 testdir = teuthology.get_testdir(ctx)
9 log.info("rados %s" % ' '.join(cmd))
13 '{tdir}/archive/coverage'.format(tdir=testdir),
19 check_status=check_status,
23 return proc.exitstatus
27 def create_ec_pool(remote, name, profile_name, pgnum, profile={}, cluster_name="ceph", application=None):
28 remote.run(args=['sudo', 'ceph'] +
29 cmd_erasure_code_profile(profile_name, profile) + ['--cluster', cluster_name])
31 'sudo', 'ceph', 'osd', 'pool', 'create', name,
32 str(pgnum), str(pgnum), 'erasure', profile_name, '--cluster', cluster_name
36 'sudo', 'ceph', 'osd', 'pool', 'application', 'enable', name, application, '--cluster', cluster_name
37 ], check_status=False) # may fail as EINVAL when run in jewel upgrade test
39 def create_replicated_pool(remote, name, pgnum, cluster_name="ceph", application=None):
41 'sudo', 'ceph', 'osd', 'pool', 'create', name, str(pgnum), str(pgnum), '--cluster', cluster_name
45 'sudo', 'ceph', 'osd', 'pool', 'application', 'enable', name, application, '--cluster', cluster_name
46 ], check_status=False)
48 def create_cache_pool(remote, base_name, cache_name, pgnum, size, cluster_name="ceph"):
50 'sudo', 'ceph', 'osd', 'pool', 'create', cache_name, str(pgnum), '--cluster', cluster_name
53 'sudo', 'ceph', 'osd', 'tier', 'add-cache', base_name, cache_name,
54 str(size), '--cluster', cluster_name
57 def cmd_erasure_code_profile(profile_name, profile):
59 Return the shell command to run to create the erasure code profile
60 described by the profile parameter.
62 :param profile_name: a string matching [A-Za-z0-9-_.]+
63 :param profile: a map whose semantic depends on the erasure code plugin
64 :returns: a shell command as an array suitable for Remote.run
66 If profile is {}, it is replaced with
68 { 'k': '2', 'm': '1', 'crush-failure-domain': 'osd'}
70 for backward compatibility. In previous versions of teuthology,
71 these values were hardcoded as function arguments and some yaml
72 files were designed with these implicit values. The teuthology
73 code should not know anything about the erasure code profile
74 content or semantic. The valid values and parameters are outside
82 'crush-failure-domain': 'osd'
85 'osd', 'erasure-code-profile', 'set',
87 ] + [ str(key) + '=' + str(value) for key, value in profile.iteritems() ]