Merge "Allow change the endpoint_type when use swift-dispersion tools"
This commit is contained in:
commit
c0e8ad609b
@ -91,19 +91,24 @@ if __name__ == '__main__':
|
|||||||
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
|
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
|
||||||
retries = int(conf.get('retries', 5))
|
retries = int(conf.get('retries', 5))
|
||||||
concurrency = int(conf.get('concurrency', 25))
|
concurrency = int(conf.get('concurrency', 25))
|
||||||
|
endpoint_type = str(conf.get('endpoint_type', 'publicURL'))
|
||||||
|
|
||||||
coropool = GreenPool(size=concurrency)
|
coropool = GreenPool(size=concurrency)
|
||||||
retries_done = 0
|
retries_done = 0
|
||||||
|
|
||||||
|
os_options = {'endpoint_type': endpoint_type}
|
||||||
|
|
||||||
url, token = get_auth(conf['auth_url'], conf['auth_user'],
|
url, token = get_auth(conf['auth_url'], conf['auth_user'],
|
||||||
conf['auth_key'],
|
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]
|
account = url.rsplit('/', 1)[1]
|
||||||
connpool = Pool(max_size=concurrency)
|
connpool = Pool(max_size=concurrency)
|
||||||
connpool.create = lambda: Connection(conf['auth_url'],
|
connpool.create = lambda: Connection(conf['auth_url'],
|
||||||
conf['auth_user'], conf['auth_key'],
|
conf['auth_user'], conf['auth_key'],
|
||||||
retries=retries,
|
retries=retries,
|
||||||
preauthurl=url, preauthtoken=token)
|
preauthurl=url, preauthtoken=token,
|
||||||
|
os_options=os_options)
|
||||||
|
|
||||||
container_ring = Ring(swift_dir, ring_name='container')
|
container_ring = Ring(swift_dir, ring_name='container')
|
||||||
parts_left = dict((x, x) for x in xrange(container_ring.partition_count))
|
parts_left = dict((x, x) for x in xrange(container_ring.partition_count))
|
||||||
|
@ -324,6 +324,7 @@ Usage: %%prog [options] [conf_file]
|
|||||||
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
|
dispersion_coverage = int(conf.get('dispersion_coverage', 1))
|
||||||
retries = int(conf.get('retries', 5))
|
retries = int(conf.get('retries', 5))
|
||||||
concurrency = int(conf.get('concurrency', 25))
|
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')):
|
if options.dump_json or config_true_value(conf.get('dump_json', 'no')):
|
||||||
json_output = True
|
json_output = True
|
||||||
container_report = config_true_value(conf.get('container_report', 'yes')) \
|
container_report = config_true_value(conf.get('container_report', 'yes')) \
|
||||||
@ -337,14 +338,17 @@ Usage: %%prog [options] [conf_file]
|
|||||||
|
|
||||||
coropool = GreenPool(size=concurrency)
|
coropool = GreenPool(size=concurrency)
|
||||||
|
|
||||||
|
os_options = {'endpoint_type': endpoint_type}
|
||||||
|
|
||||||
url, token = get_auth(conf['auth_url'], conf['auth_user'],
|
url, token = get_auth(conf['auth_url'], conf['auth_user'],
|
||||||
conf['auth_key'],
|
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]
|
account = url.rsplit('/', 1)[1]
|
||||||
connpool = Pool(max_size=concurrency)
|
connpool = Pool(max_size=concurrency)
|
||||||
connpool.create = lambda: Connection(
|
connpool.create = lambda: Connection(
|
||||||
conf['auth_url'], conf['auth_user'], conf['auth_key'], retries=retries,
|
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')
|
container_ring = Ring(swift_dir, ring_name='container')
|
||||||
object_ring = Ring(swift_dir, ring_name='object')
|
object_ring = Ring(swift_dir, ring_name='object')
|
||||||
|
@ -69,6 +69,7 @@ Example \fI/etc/swift/dispersion.conf\fR:
|
|||||||
.IP "# dispersion_coverage = 1"
|
.IP "# dispersion_coverage = 1"
|
||||||
.IP "# retries = 5"
|
.IP "# retries = 5"
|
||||||
.IP "# concurrency = 25"
|
.IP "# concurrency = 25"
|
||||||
|
.IP "# endpoint_type = publicURL"
|
||||||
.RE
|
.RE
|
||||||
.PD
|
.PD
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
@ -98,6 +98,7 @@ Example \fI/etc/swift/dispersion.conf\fR:
|
|||||||
.IP "# retries = 5"
|
.IP "# retries = 5"
|
||||||
.IP "# concurrency = 25"
|
.IP "# concurrency = 25"
|
||||||
.IP "# dump_json = no"
|
.IP "# dump_json = no"
|
||||||
|
.IP "# endpoint_type = publicURL"
|
||||||
.RE
|
.RE
|
||||||
.PD
|
.PD
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
@ -208,6 +208,7 @@ configuration file, /etc/swift/dispersion.conf. Example conf file::
|
|||||||
auth_url = http://localhost:8080/auth/v1.0
|
auth_url = http://localhost:8080/auth/v1.0
|
||||||
auth_user = test:tester
|
auth_user = test:tester
|
||||||
auth_key = testing
|
auth_key = testing
|
||||||
|
endpoint_type = internalURL
|
||||||
|
|
||||||
There are also options for the conf file for specifying the dispersion coverage
|
There are also options for the conf file for specifying the dispersion coverage
|
||||||
(defaults to 1%), retries, concurrency, etc. though usually the defaults are
|
(defaults to 1%), retries, concurrency, etc. though usually the defaults are
|
||||||
|
@ -6,6 +6,7 @@ auth_key = testing
|
|||||||
# auth_user = test:tester
|
# auth_user = test:tester
|
||||||
# auth_key = testing
|
# auth_key = testing
|
||||||
# auth_version = 2.0
|
# auth_version = 2.0
|
||||||
|
# endpoint_type = publicURL
|
||||||
#
|
#
|
||||||
# swift_dir = /etc/swift
|
# swift_dir = /etc/swift
|
||||||
# dispersion_coverage = 1
|
# dispersion_coverage = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user