rgw multisite configuration routines
"""
import argparse
-import contextlib
import logging
import random
import string
from copy import deepcopy
-from util.rgw import rgwadmin, wait_for_radosgw
-from util.rados import create_ec_pool, create_replicated_pool
-from rgw_multi import multisite
-from rgw_multi.zone_rados import RadosZone as RadosZone
+from tasks.util.rgw import rgwadmin, wait_for_radosgw
+from tasks.util.rados import create_ec_pool, create_replicated_pool
+from tasks.rgw_multi import multisite
+from tasks.rgw_multi.zone_rados import RadosZone as RadosZone
+from tasks.rgw_multi.zone_ps import PSZone as PSZone
from teuthology.orchestra import run
from teuthology import misc
* 'is_master' is passed on the command line as --master
* 'is_default' is passed on the command line as --default
+ * 'is_pubsub' is used to create a zone with tier-type=pubsub
* 'endpoints' given as client names are replaced with actual endpoints
zonegroups:
- name: test-zone2
is_default: true
endpoints: [c2.client.0]
+ - name: test-zone3
+ is_pubsub: true
+ endpoints: [c1.client.1]
"""
def __init__(self, ctx, config):
# insert zone args before the first |
pipe = args.index(run.Raw('|'))
args = args[0:pipe] + zone.zone_args() + args[pipe:]
- except ValueError, e:
+ except ValueError:
args += zone.zone_args()
self.daemon.command_kwargs['args'] = args
""" (re)start the daemon """
self.daemon.restart()
# wait until startup completes
- wait_for_radosgw(self.endpoint())
+ wait_for_radosgw(self.endpoint(), self.remote)
def stop(self):
""" stop the daemon """
""" create cluster and gateway instances for all of the radosgw roles """
clusters = {}
gateways = {}
- for role, (host, port) in role_endpoints.iteritems():
+ for role, endpoint in role_endpoints.items():
cluster_name, daemon_type, client_id = misc.split_role(role)
# find or create the cluster by name
cluster = clusters.get(cluster_name)
raise ConfigError('no daemon for role=%s cluster=%s type=rgw id=%s' % \
(role, cluster_name, client_id))
(remote,) = ctx.cluster.only(role).remotes.keys()
- gateways[role] = Gateway(role, remote, daemon, host, port, cluster)
+ gateways[role] = Gateway(role, remote, daemon, endpoint.hostname,
+ endpoint.port, cluster)
return clusters, gateways
def create_realm(cluster, config):
def create_zone(ctx, cluster, gateways, creds, zonegroup, config):
""" create a zone with the given configuration """
zone = multisite.Zone(config['name'], zonegroup, cluster)
- zone = RadosZone(config['name'], zonegroup, cluster)
+ if config.pop('is_pubsub', False):
+ zone = PSZone(config['name'], zonegroup, cluster)
+ else:
+ zone = RadosZone(config['name'], zonegroup, cluster)
# collect Gateways for the zone's endpoints
endpoints = config.get('endpoints')
gateway = zone.gateways[0]
cluster = zone.cluster
for pool_config in zone.data.get('placement_pools', []):
- pool_name = pool_config['val']['data_pool']
+ pool_name = pool_config['val']['storage_classes']['STANDARD']['data_pool']
if ctx.rgw.ec_data_pool:
create_ec_pool(gateway.remote, pool_name, zone.name, 64,
ctx.rgw.erasure_code_profile, cluster.name, 'rgw')