]> git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/manypools.py
import ceph 15.2.10
[ceph.git] / ceph / qa / tasks / manypools.py
1 """
2 Force pg creation on all osds
3 """
4 from teuthology import misc as teuthology
5 from teuthology.orchestra import run
6 import logging
7
8 log = logging.getLogger(__name__)
9
10 def task(ctx, config):
11 """
12 Create the specified number of pools and write 16 objects to them (thereby forcing
13 the PG creation on each OSD). This task creates pools from all the clients,
14 in parallel. It is easy to add other daemon types which have the appropriate
15 permissions, but I don't think anything else does.
16 The config is just the number of pools to create. I recommend setting
17 "mon create pg interval" to a very low value in your ceph config to speed
18 this up.
19
20 You probably want to do this to look at memory consumption, and
21 maybe to test how performance changes with the number of PGs. For example:
22
23 tasks:
24 - ceph:
25 config:
26 mon:
27 mon create pg interval: 1
28 - manypools: 3000
29 - radosbench:
30 clients: [client.0]
31 time: 360
32 """
33
34 log.info('creating {n} pools'.format(n=config))
35
36 poolnum = int(config)
37 creator_remotes = []
38 client_roles = teuthology.all_roles_of_type(ctx.cluster, 'client')
39 log.info('got client_roles={client_roles_}'.format(client_roles_=client_roles))
40 for role in client_roles:
41 log.info('role={role_}'.format(role_=role))
42 (creator_remote, ) = ctx.cluster.only('client.{id}'.format(id=role)).remotes.keys()
43 creator_remotes.append((creator_remote, 'client.{id}'.format(id=role)))
44
45 remaining_pools = poolnum
46 poolprocs=dict()
47 while (remaining_pools > 0):
48 log.info('{n} pools remaining to create'.format(n=remaining_pools))
49 for remote, role_ in creator_remotes:
50 poolnum = remaining_pools
51 remaining_pools -= 1
52 if remaining_pools < 0:
53 continue
54 log.info('creating pool{num} on {role}'.format(num=poolnum, role=role_))
55 proc = remote.run(
56 args=[
57 'ceph',
58 '--name', role_,
59 'osd', 'pool', 'create', 'pool{num}'.format(num=poolnum), '8',
60 run.Raw('&&'),
61 'rados',
62 '--name', role_,
63 '--pool', 'pool{num}'.format(num=poolnum),
64 'bench', '0', 'write', '-t', '16', '--block-size', '1'
65 ],
66 wait = False
67 )
68 log.info('waiting for pool and object creates')
69 poolprocs[remote] = proc
70
71 run.wait(poolprocs.values())
72
73 log.info('created all {n} pools and wrote 16 objects to each'.format(n=poolnum))