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