Allow change the endpoint_type when use swift-dispersion tools
Fixes bug 1102319 DocImpact Change-Id: I8fb0417ab9468e97ed01a6cb1e262630905e7f29
This commit is contained in:
		@@ -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))
 | 
			
		||||
 
 | 
			
		||||
@@ -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')
 | 
			
		||||
 
 | 
			
		||||
@@ -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 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user