Modify glance sync not auth loc when add glance-loc
Modify glance sync not auth loc when add glance-loc Change-Id: I3c1ff1c11c688a89700329e679c9301b06e7fa50
This commit is contained in:
parent
44c77a238e
commit
989caf0c9e
|
@ -579,7 +579,7 @@ class SyncManagerV2():
|
|||
self_restful_client = create_self_restful_client(auth_token)
|
||||
path = s_utils.generate_glance_location(cascaded_ep, cascaded_id)
|
||||
# add the auth_token, so this url can be visited, otherwise 404 error
|
||||
path += '?auth_token=' + auth_token
|
||||
path += '?auth_token=1'
|
||||
metadata = {'image_id': cascaded_id}
|
||||
if action:
|
||||
metadata['action'] = action
|
||||
|
|
|
@ -88,9 +88,10 @@ class StoreLocation(glance_store.location.StoreLocation):
|
|||
if netloc == '':
|
||||
LOG.info(_("No address specified in HTTP URL"))
|
||||
raise exceptions.BadStoreUri(uri=uri)
|
||||
|
||||
self.netloc = netloc
|
||||
self.path = path
|
||||
self.token = None
|
||||
self.token = None
|
||||
if pieces.query:
|
||||
params = pieces.query.split('&')
|
||||
for param in params:
|
||||
|
@ -173,18 +174,18 @@ class Store(glance_store.driver.Store):
|
|||
loc = location.store_location
|
||||
conn_class = self._get_conn_class(loc)
|
||||
conn = conn_class(loc.netloc)
|
||||
hearders = {}
|
||||
if loc.token:
|
||||
hearders.setdefault('x-auth-token', loc.token)
|
||||
verb = 'GET'
|
||||
conn.request(verb, loc.path, "", hearders)
|
||||
resp = conn.getresponse()
|
||||
try:
|
||||
size = jsonutils.loads(resp.read())['size']
|
||||
except Exception:
|
||||
size = 0
|
||||
raise exception.BadStoreUri(loc.path, reason)
|
||||
return (conn, resp, size)
|
||||
hearders = {}
|
||||
if loc.token:
|
||||
# hearders.setdefault('x-auth-token', loc.token)
|
||||
# verb = 'GET'
|
||||
# conn.request(verb, loc.path, "", hearders)
|
||||
# resp = conn.getresponse()
|
||||
# try:
|
||||
# size = jsonutils.loads(resp.read())['size']
|
||||
# except Exception:
|
||||
# size = 0
|
||||
# raise exception.BadStoreUri(loc.path, reason)
|
||||
return (conn, None, 1)
|
||||
|
||||
conn.request(verb, loc.path, "", {})
|
||||
resp = conn.getresponse()
|
||||
|
|
Loading…
Reference in New Issue