Merge "Allow change the endpoint_type when use swift-dispersion tools"

This commit is contained in:
Jenkins 2013-02-08 23:55:03 +00:00 committed by Gerrit Code Review
commit c0e8ad609b
6 changed files with 17 additions and 4 deletions

View File

@ -91,19 +91,24 @@ if __name__ == '__main__':
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
retries = int(conf.get('retries', 5))
concurrency = int(conf.get('concurrency', 25))
endpoint_type = str(conf.get('endpoint_type', 'publicURL'))
coropool = GreenPool(size=concurrency)
retries_done = 0
os_options = {'endpoint_type': endpoint_type}
url, token = get_auth(conf['auth_url'], conf['auth_user'],
conf['auth_key'],
auth_version=conf.get('auth_version', '1.0'))
auth_version=conf.get('auth_version', '1.0'),
os_options=os_options)
account = url.rsplit('/', 1)[1]
connpool = Pool(max_size=concurrency)
connpool.create = lambda: Connection(conf['auth_url'],
conf['auth_user'], conf['auth_key'],
retries=retries,
preauthurl=url, preauthtoken=token)
preauthurl=url, preauthtoken=token,
os_options=os_options)
container_ring = Ring(swift_dir, ring_name='container')
parts_left = dict((x, x) for x in xrange(container_ring.partition_count))

View File

@ -324,6 +324,7 @@ Usage: %%prog [options] [conf_file]
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
retries = int(conf.get('retries', 5))
concurrency = int(conf.get('concurrency', 25))
endpoint_type = str(conf.get('endpoint_type', 'publicURL'))
if options.dump_json or config_true_value(conf.get('dump_json', 'no')):
json_output = True
container_report = config_true_value(conf.get('container_report', 'yes')) \
@ -337,14 +338,17 @@ Usage: %%prog [options] [conf_file]
coropool = GreenPool(size=concurrency)
os_options = {'endpoint_type': endpoint_type}
url, token = get_auth(conf['auth_url'], conf['auth_user'],
conf['auth_key'],
auth_version=conf.get('auth_version', '1.0'))
auth_version=conf.get('auth_version', '1.0'),
os_options=os_options)
account = url.rsplit('/', 1)[1]
connpool = Pool(max_size=concurrency)
connpool.create = lambda: Connection(
conf['auth_url'], conf['auth_user'], conf['auth_key'], retries=retries,
preauthurl=url, preauthtoken=token)
preauthurl=url, preauthtoken=token, os_options=os_options)
container_ring = Ring(swift_dir, ring_name='container')
object_ring = Ring(swift_dir, ring_name='object')

View File

@ -69,6 +69,7 @@ Example \fI/etc/swift/dispersion.conf\fR:
.IP "# dispersion_coverage = 1"
.IP "# retries = 5"
.IP "# concurrency = 25"
.IP "# endpoint_type = publicURL"
.RE
.PD
.SH EXAMPLE

View File

@ -98,6 +98,7 @@ Example \fI/etc/swift/dispersion.conf\fR:
.IP "# retries = 5"
.IP "# concurrency = 25"
.IP "# dump_json = no"
.IP "# endpoint_type = publicURL"
.RE
.PD
.SH EXAMPLE

View File

@ -208,6 +208,7 @@ configuration file, /etc/swift/dispersion.conf. Example conf file::
auth_url = http://localhost:8080/auth/v1.0
auth_user = test:tester
auth_key = testing
endpoint_type = internalURL
There are also options for the conf file for specifying the dispersion coverage
(defaults to 1%), retries, concurrency, etc. though usually the defaults are

View File

@ -6,6 +6,7 @@ auth_key = testing
# auth_user = test:tester
# auth_key = testing
# auth_version = 2.0
# endpoint_type = publicURL
#
# swift_dir = /etc/swift
# dispersion_coverage = 1