From: Christophe Courtaut Date: Thu, 10 Oct 2013 10:27:27 +0000 (+0200) Subject: Reflect radosgw-agent option changes in teuthology X-Git-Tag: 1.1.0~1787^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d65a0b9efa62ee4b5ca2cd70a52f82dcacbf00c4;p=teuthology.git Reflect radosgw-agent option changes in teuthology Signed-off-by: Christophe Courtaut --- diff --git a/teuthology/task/radosgw-agent.py b/teuthology/task/radosgw-agent.py index 014a1b144..52fbcbf18 100644 --- a/teuthology/task/radosgw-agent.py +++ b/teuthology/task/radosgw-agent.py @@ -26,6 +26,9 @@ def run_radosgw_agent(ctx, config): src_zone = rgw_utils.zone_for_client(ctx, src_client) dest_zone = rgw_utils.zone_for_client(ctx, dest_client) + src_region = rgw_utils.region_for_client(ctx, src_client) + dest_region = rgw_utils.region_for_client(ctx, dest_client) + log.info("source is %s", src_zone) log.info("dest is %s", dest_zone) @@ -81,18 +84,13 @@ def run_radosgw_agent(ctx, config): '-v', '--src-access-key', src_access, '--src-secret-key', src_secret, - '--src-host', src_host, - '--src-port', str(src_port), - '--src-zone', src_zone, + '--source', "http://{addr}:{port}".format(addr=src_host, port=src_port), '--dest-access-key', dest_access, '--dest-secret-key', dest_secret, - '--dest-host', dest_host, - '--dest-port', str(dest_port), - '--dest-zone', dest_zone, - '--daemon-id', daemon_name, '--log-file', '{tdir}/archive/rgw_sync_agent.{client}.log'.format( tdir=testdir, client=client), + "http://{addr}:{port}".format(addr=dest_host, port=dest_port), ] # the test server and full/incremental flags are mutually exclusive if sync_scope is None: diff --git a/teuthology/task_util/rgw.py b/teuthology/task_util/rgw.py index 14216b92b..7b3ba4756 100644 --- a/teuthology/task_util/rgw.py +++ b/teuthology/task_util/rgw.py @@ -105,18 +105,32 @@ def zone_for_client(ctx, client): ceph_config.update(ctx.ceph.conf.get(client, {})) return ceph_config.get('rgw zone') +def region_for_client(ctx, client): + ceph_config = ctx.ceph.conf.get('global', {}) + ceph_config.update(ctx.ceph.conf.get('client', {})) + ceph_config.update(ctx.ceph.conf.get(client, {})) + return ceph_config.get('rgw region') + + +def radosgw_agent_sync_data(ctx, agent_host, agent_port, full=False): + log.info('sync agent {h}:{p}'.format(h=agent_host, p=agent_port)) + method = "full" if full else "incremental" + return requests.post('http://{addr}:{port}/data/{method}'.format(addr = agent_host, port = agent_port, method = method)) -def radosgw_agent_sync(ctx, agent_host, agent_port): +def radosgw_agent_sync_metadata(ctx, agent_host, agent_port, full=False): log.info('sync agent {h}:{p}'.format(h=agent_host, p=agent_port)) - return requests.post('http://{addr}:{port}/metadata/incremental'.format(addr = agent_host, port = agent_port)) + method = "full" if full else "incremental" + return requests.post('http://{addr}:{port}/metadata/{method}'.format(addr = agent_host, port = agent_port, method = method)) -def radosgw_agent_sync_all(ctx): +def radosgw_agent_sync_all(ctx, full=False, data=False): if ctx.radosgw_agent.procs: for agent_client, c_config in ctx.radosgw_agent.config.iteritems(): zone_for_client(ctx, agent_client) sync_host, sync_port = get_sync_agent(ctx, agent_client) log.debug('doing a sync via {host1}'.format(host1=sync_host)) - radosgw_agent_sync(ctx, sync_host, sync_port) + radosgw_agent_sync_metadata(ctx, sync_host, sync_port, full) + if (data): + radosgw_agent_sync_data(ctx, sync_host, sync_port, full) def host_for_role(ctx, role): for target, roles in zip(ctx.config['targets'].iterkeys(), ctx.config['roles']):