]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/watch_notify_same_primary.py
7160979119b38ff0c640d5caee33ed04b0cf4f32
3 watch_notify_same_primary task
11 from teuthology
.orchestra
import run
12 from teuthology
.contextutil
import safe_while
14 log
= logging
.getLogger(__name__
)
17 @contextlib.contextmanager
18 def task(ctx
, config
):
20 Run watch_notify_same_primary
22 The config should be as follows:
24 watch_notify_same_primary:
25 clients: [client list]
27 The client list should contain 1 client
29 The test requires 3 osds.
35 - watch_notify_same_primary:
39 log
.info('Beginning watch_notify_same_primary...')
40 assert isinstance(config
, dict), \
41 "please list clients to run on"
43 clients
= config
.get('clients', ['client.0'])
44 assert len(clients
) == 1
46 assert isinstance(role
, six
.string_types
)
48 assert role
.startswith(PREFIX
)
49 (remote
,) = ctx
.cluster
.only(role
).remotes
.keys()
50 manager
= ctx
.managers
['ceph']
51 manager
.raw_cluster_cmd('osd', 'set', 'noout')
53 pool
= manager
.create_pool_with_unique_name()
54 def obj(n
): return "foo-{num}".format(num
=n
)
63 logger
=log
.getChild('watch.{id}'.format(id=n
)))
78 watches
= [start_watch(i
) for i
in range(num
)]
80 # wait for them all to register
82 with
safe_while() as proceed
:
85 ["rados", "-p", pool
, "listwatchers", obj(i
)])
86 num_watchers
= lines
.count('watcher=')
87 log
.info('i see %d watchers for %s', num_watchers
, obj(i
))
99 logger
=log
.getChild('notify.{id}'.format(id=n
)))
101 [notify(n
, 'notify1') for n
in range(len(watches
))]
104 manager
.mark_down_osd(0)
106 [notify(n
, 'notify2') for n
in range(len(watches
))]
111 log
.info('joining watch_notify_stress')
112 for watch
in watches
:
113 watch
.stdin
.write("\n")
117 for watch
in watches
:
118 lines
= watch
.stdout
.getvalue().split("\n")
129 manager
.revive_osd(0)
130 manager
.remove_pool(pool
)