+"""
+rgw s3tests logging wrappers
+"""
from cStringIO import StringIO
from configobj import ConfigObj
import contextlib
@contextlib.contextmanager
def download(ctx, config):
- return s3tests.do_download(ctx, config)
+ """
+ Run s3tests download function
+ """
+ return s3tests.download(ctx, config)
def _config_user(s3tests_conf, section, user):
+ """
+ Run s3tests user config function
+ """
return s3tests._config_user(s3tests_conf, section, user)
@contextlib.contextmanager
def create_users(ctx, config):
- return s3tests.do_create_users(ctx, config)
+ """
+ Run s3tests user create function
+ """
+ return s3tests.create_users(ctx, config)
@contextlib.contextmanager
def configure(ctx, config):
- return s3tests.do_configure(ctx, config)
+ """
+ Run s3tests user configure function
+ """
+ return s3tests.configure(ctx, config)
@contextlib.contextmanager
def run_tests(ctx, config):
+ """
+ Run remote netcat tests
+ """
assert isinstance(config, dict)
testdir = teuthology.get_testdir(ctx)
for client, client_config in config.iteritems():
client_config['extra_args'] = [
- 's3tests.functional.test_s3:test_bucket_list_return_data',
- ]
-
+ 's3tests.functional.test_s3:test_bucket_list_return_data',
+ ]
# args = [
# 'S3TEST_CONF={tdir}/archive/s3-tests.{client}.conf'.format(tdir=testdir, client=client),
# '{tdir}/s3-tests/virtualenv/bin/nosetests'.format(tdir=testdir),
# args=args,
# )
- s3tests.do_run_tests(ctx, config)
+ s3tests.run_tests(ctx, config)
netcat_out = StringIO()
+"""
+rgw routines
+"""
import argparse
import contextlib
import json
@contextlib.contextmanager
def create_dirs(ctx, config):
+ """
+ Remotely create apache directories. Delete when finished.
+ """
log.info('Creating apache directories...')
testdir = teuthology.get_testdir(ctx)
for client in config.iterkeys():
@contextlib.contextmanager
def ship_config(ctx, config, role_endpoints):
+ """
+ Ship apache config and rgw.fgci to all clients. Clean up on termination
+ """
assert isinstance(config, dict)
assert isinstance(role_endpoints, dict)
testdir = teuthology.get_testdir(ctx)
@contextlib.contextmanager
def start_rgw(ctx, config):
+ """
+ Start rgw on remote sites.
+ """
log.info('Starting rgw...')
testdir = teuthology.get_testdir(ctx)
for client in config.iterkeys():
log.info("rgw %s config is %s", client, client_config)
id_ = client.split('.', 1)[1]
log.info('client {client} is id {id}'.format(client=client, id=id_))
- run_cmd=[
+ run_cmd = [
'sudo',
'adjust-ulimits',
'ceph-coverage',
'daemon-helper',
'term',
]
- run_cmd_tail=[
+ run_cmd_tail = [
'radosgw',
'-n', client,
'-k', '/etc/ceph/ceph.{client}.keyring'.format(client=client),
@contextlib.contextmanager
def start_apache(ctx, config):
+ """
+ Start apache on remote sites.
+ """
log.info('Starting apache...')
testdir = teuthology.get_testdir(ctx)
apaches = {}
run.wait(apaches.itervalues())
def extract_user_info(client_config):
+ """
+ Extract user info from the client config specified. Returns a dict
+ that includes system key information.
+ """
# test if there isn't a system user or if there isn't a name for that user, return None
if 'system user' not in client_config or 'name' not in client_config['system user']:
return None
return user_info
def extract_zone_info(ctx, client, client_config):
-
+ """
+ Get zone information.
+ :param client: dictionary of client information
+ :param client_config: dictionary of client configuration information
+ :returns: zone extracted from client and client_config information
+ """
ceph_config = ctx.ceph.conf.get('global', {})
ceph_config.update(ctx.ceph.conf.get('client', {}))
ceph_config.update(ctx.ceph.conf.get(client, {}))
for key in ['rgw control pool', 'rgw gc pool', 'rgw log pool', 'rgw intent log pool',
'rgw usage log pool', 'rgw user keys pool', 'rgw user email pool',
'rgw user swift pool', 'rgw user uid pool', 'rgw domain root']:
- new_key = key.split(' ',1)[1]
+ new_key = key.split(' ', 1)[1]
new_key = new_key.replace(' ', '_')
if key in ceph_config:
return region, zone, zone_info
def extract_region_info(region, region_info):
+ """
+ Extract region information from the region_info parameter, using get
+ to set default values.
+
+ :param region: name of the region
+ :param region_info: region information (in dictionary form).
+ :returns: dictionary of region information set from region_info, using
+ default values for missing fields.
+ """
assert isinstance(region_info['zones'], list) and region_info['zones'], \
'zones must be a non-empty list'
return dict(
)
def assign_ports(ctx, config):
+ """
+ Assign port numberst starting with port 7280.
+ """
port = 7280
role_endpoints = {}
for remote, roles_for_host in ctx.cluster.remotes.iteritems():
return role_endpoints
def fill_in_endpoints(region_info, role_zones, role_endpoints):
+ """
+ Iterate through the list of role_endpoints, filling in zone information
+
+ :param region_info: region data
+ :param role_zones: region and zone information.
+ :param role_endpoints: endpoints being used
+ """
for role, (host, port) in role_endpoints.iteritems():
region, zone, zone_info, _ = role_zones[role]
host, port = role_endpoints[role]
# If not, throw a reasonable error
if region not in region_info:
raise Exception('Region: {region} was specified but no corresponding' \
- ' entry was round under \'regions\''.format(region=region))
+ ' entry was found under \'regions\''.format(region=region))
region_conf = region_info[region]
region_conf.setdefault('endpoints', [])
# Pull the log meta and log data settings out of zone_info, if they exist, then pop them
# as they don't actually belong in the zone info
for key in ['rgw log meta', 'rgw log data']:
- new_key = key.split(' ',1)[1]
+ new_key = key.split(' ', 1)[1]
new_key = new_key.replace(' ', '_')
if key in zone_info:
@contextlib.contextmanager
def configure_users(ctx, config):
+ """
+ Create users by remotely running rgwadmin commands using extracted
+ user information.
+ """
log.info('Configuring users...')
# extract the user info and append it to the payload tuple for the given client
@contextlib.contextmanager
def configure_regions_and_zones(ctx, config, regions, role_endpoints):
+ """
+ Configure regions and zones from rados and rgw.
+ """
if not regions:
log.debug('In rgw.configure_regions_and_zones() and regions is None. Bailing')
yield