ceph/teuthology/task_util/rgw.py
Josh Durgin 8ad065dc9c rgw: add multi-region and zone support
Take client<->zone/region and the associated pools from ceph.conf, so
we don't have to invent a new format to specify it.

General region info is added to a new configuration section in the rgw
task. Each client is assumed to be a different zone, and a system user
is created with the key specified in the yaml, so it can be passed to
later task configuration as well. This isn't strictly necessary, but
avoids having to lookup this info in later tasks through something
like radosgw-admin.

Ports are allocated automatically because there's no obvious mapping
from host to client in the task configuration. Later tests can get the
endpoints desired by reading the region map.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2013-07-24 09:59:50 -07:00

40 lines
1.1 KiB
Python

from cStringIO import StringIO
import logging
import json
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
def rgwadmin(ctx, client, cmd, stdin=StringIO(), check_status=False):
log.info('radosgw-admin: %s' % cmd)
testdir = teuthology.get_testdir(ctx)
pre = [
'{tdir}/adjust-ulimits'.format(tdir=testdir),
'ceph-coverage'.format(tdir=testdir),
'{tdir}/archive/coverage'.format(tdir=testdir),
'radosgw-admin'.format(tdir=testdir),
'--log-to-stderr',
'--format', 'json',
]
pre.extend(cmd)
(remote,) = ctx.cluster.only(client).remotes.iterkeys()
proc = remote.run(
args=pre,
check_status=check_status,
stdout=StringIO(),
stderr=StringIO(),
stdin=stdin,
)
r = proc.exitstatus
out = proc.stdout.getvalue()
j = None
if not r and out != '':
try:
j = json.loads(out)
log.info(' json result: %s' % j)
except ValueError:
j = out
log.info(' raw result: %s' % j)
return (r, j)