]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Reflect radosgw-agent option changes in teuthology
authorChristophe Courtaut <christophe.courtaut@gmail.com>
Thu, 10 Oct 2013 10:27:27 +0000 (12:27 +0200)
committerJosh Durgin <josh.durgin@inktank.com>
Wed, 30 Oct 2013 16:57:49 +0000 (09:57 -0700)
Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
teuthology/task/radosgw-agent.py
teuthology/task_util/rgw.py

index 014a1b1441349077b6ca60f452839a9dd14eb33f..52fbcbf18a0e5d4ba119dda9897f9c42984922a4 100644 (file)
@@ -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:
index 14216b92bad6694254655fe57e0e7e1f3f2d1a21..7b3ba47565321f2335805ca4ae1a9a81cc5602be 100644 (file)
@@ -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']):