2013-10-12 08:28:27 +00:00
|
|
|
"""
|
|
|
|
test_stress_watch task
|
|
|
|
"""
|
2011-09-22 20:23:05 +00:00
|
|
|
import contextlib
|
|
|
|
import logging
|
2011-10-06 20:33:17 +00:00
|
|
|
import proc_thrasher
|
2011-09-22 20:23:05 +00:00
|
|
|
|
2014-08-07 14:24:59 +00:00
|
|
|
from teuthology.orchestra import run
|
2011-09-22 20:23:05 +00:00
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2013-09-26 15:47:43 +00:00
|
|
|
|
2011-09-22 20:23:05 +00:00
|
|
|
@contextlib.contextmanager
|
|
|
|
def task(ctx, config):
|
|
|
|
"""
|
|
|
|
Run test_stress_watch
|
|
|
|
|
|
|
|
The config should be as follows:
|
|
|
|
|
|
|
|
test_stress_watch:
|
|
|
|
clients: [client list]
|
|
|
|
|
|
|
|
example:
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- ceph:
|
|
|
|
- test_stress_watch:
|
|
|
|
clients: [client.0]
|
|
|
|
- interactive:
|
|
|
|
"""
|
|
|
|
log.info('Beginning test_stress_watch...')
|
|
|
|
assert isinstance(config, dict), \
|
|
|
|
"please list clients to run on"
|
2011-10-06 20:33:17 +00:00
|
|
|
testwatch = {}
|
2011-09-22 20:23:05 +00:00
|
|
|
|
|
|
|
remotes = []
|
2013-01-23 20:37:39 +00:00
|
|
|
|
2011-09-22 20:23:05 +00:00
|
|
|
for role in config.get('clients', ['client.0']):
|
|
|
|
assert isinstance(role, basestring)
|
|
|
|
PREFIX = 'client.'
|
|
|
|
assert role.startswith(PREFIX)
|
|
|
|
id_ = role[len(PREFIX):]
|
2014-03-27 16:35:28 +00:00
|
|
|
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
|
2011-09-22 20:23:05 +00:00
|
|
|
remotes.append(remote)
|
|
|
|
|
2011-10-06 20:33:17 +00:00
|
|
|
args =['CEPH_CLIENT_ID={id_}'.format(id_=id_),
|
|
|
|
'CEPH_ARGS="{flags}"'.format(flags=config.get('flags', '')),
|
2013-09-06 20:08:01 +00:00
|
|
|
'daemon-helper',
|
2013-09-09 19:07:29 +00:00
|
|
|
'kill',
|
2013-02-06 19:16:52 +00:00
|
|
|
'multi_stress_watch foo foo'
|
2011-10-06 20:33:17 +00:00
|
|
|
]
|
2011-10-03 21:04:53 +00:00
|
|
|
|
|
|
|
log.info("args are %s" % (args,))
|
|
|
|
|
2011-10-06 20:33:17 +00:00
|
|
|
proc = proc_thrasher.ProcThrasher({}, remote,
|
|
|
|
args=[run.Raw(i) for i in args],
|
|
|
|
logger=log.getChild('testwatch.{id}'.format(id=id_)),
|
2011-09-22 20:23:05 +00:00
|
|
|
stdin=run.PIPE,
|
|
|
|
wait=False
|
|
|
|
)
|
2011-10-06 20:33:17 +00:00
|
|
|
proc.start()
|
|
|
|
testwatch[id_] = proc
|
2011-09-22 20:23:05 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
yield
|
|
|
|
finally:
|
|
|
|
log.info('joining watch_notify_stress')
|
2011-10-06 20:33:17 +00:00
|
|
|
for i in testwatch.itervalues():
|
|
|
|
i.join()
|