]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/util/rgw.py
91652198b8a6f57dc047b503aaf4d859858283c0
1 from cStringIO
import StringIO
6 from teuthology
import misc
as teuthology
8 log
= logging
.getLogger(__name__
)
10 def rgwadmin(ctx
, client
, cmd
, stdin
=StringIO(), check_status
=False,
11 format
='json', decode
=True, log_level
=logging
.DEBUG
):
12 log
.info('rgwadmin: {client} : {cmd}'.format(client
=client
,cmd
=cmd
))
13 testdir
= teuthology
.get_testdir(ctx
)
14 cluster_name
, daemon_type
, client_id
= teuthology
.split_role(client
)
15 client_with_id
= daemon_type
+ '.' + client_id
19 '{tdir}/archive/coverage'.format(tdir
=testdir
),
24 '--cluster', cluster_name
,
27 log
.log(log_level
, 'rgwadmin: cmd=%s' % pre
)
28 (remote
,) = ctx
.cluster
.only(client
).remotes
.keys()
31 check_status
=check_status
,
37 out
= proc
.stdout
.getvalue()
41 if not r
and out
!= '':
44 log
.log(log_level
, ' json result: %s' % j
)
47 log
.log(log_level
, ' raw result: %s' % j
)
50 def get_user_summary(out
, user
):
51 """Extract the summary for a given user"""
53 for summary
in out
['summary']:
54 if summary
.get('user') == user
:
55 user_summary
= summary
58 raise AssertionError('No summary info found for user: %s' % user
)
62 def get_user_successful_ops(out
, user
):
63 summary
= out
['summary']
66 return get_user_summary(out
, user
)['total']['successful_ops']
68 def wait_for_radosgw(url
, remote
):
69 """ poll the given url until it starts accepting connections
71 add_daemon() doesn't wait until radosgw finishes startup, so this is used
72 to avoid racing with later tasks that expect radosgw to be up and listening
74 # TODO: use '--retry-connrefused --retry 8' when teuthology is running on
75 # Centos 8 and other OS's with an updated version of curl
80 for seconds
in range(num_retries
):
88 exit_status
= proc
.exitstatus
91 time
.sleep(2**seconds
)
93 assert exit_status
== 0