Fixes incorrect URI scheme for s3 backend
Fixes bug #912094.
URI scheme for s3 backend should be 's3+https', not 'swift+https'.
Use s3.amazonaws.com instead of s3service.com to follow RFC2606.
Indent reason for BadStoreUri exception in s3.py.
Comments added for the following option in etc/glance-api.conf
's3_store_host'
(cherry picked from commit d466cec357
)
Change-Id: Id456b287d82fe61711f0d738e61ccb599f0b5684
This commit is contained in:
parent
c989c54023
commit
5e7c88026e
|
@ -94,6 +94,8 @@ swift_enable_snet = False
|
||||||
# ============ S3 Store Options =============================
|
# ============ S3 Store Options =============================
|
||||||
|
|
||||||
# Address where the S3 authentication service lives
|
# Address where the S3 authentication service lives
|
||||||
|
# Valid schemes are 'http://' and 'https://'
|
||||||
|
# If no scheme specified, default to 'http://'
|
||||||
s3_store_host = 127.0.0.1:8080/v1.0/
|
s3_store_host = 127.0.0.1:8080/v1.0/
|
||||||
|
|
||||||
# User to authenticate against the S3 authentication service
|
# User to authenticate against the S3 authentication service
|
||||||
|
|
|
@ -38,9 +38,9 @@ class StoreLocation(glance.store.location.StoreLocation):
|
||||||
Class describing an S3 URI. An S3 URI can look like any of
|
Class describing an S3 URI. An S3 URI can look like any of
|
||||||
the following:
|
the following:
|
||||||
|
|
||||||
s3://accesskey:secretkey@s3service.com/bucket/key-id
|
s3://accesskey:secretkey@s3.amazonaws.com/bucket/key-id
|
||||||
s3+http://accesskey:secretkey@s3service.com/bucket/key-id
|
s3+http://accesskey:secretkey@s3.amazonaws.com/bucket/key-id
|
||||||
s3+https://accesskey:secretkey@s3service.com/bucket/key-id
|
s3+https://accesskey:secretkey@s3.amazonaws.com/bucket/key-id
|
||||||
|
|
||||||
The s3+https:// URIs indicate there is an HTTPS s3service URL
|
The s3+https:// URIs indicate there is an HTTPS s3service URL
|
||||||
"""
|
"""
|
||||||
|
@ -84,15 +84,19 @@ class StoreLocation(glance.store.location.StoreLocation):
|
||||||
This function works around that issue.
|
This function works around that issue.
|
||||||
"""
|
"""
|
||||||
# Make sure that URIs that contain multiple schemes, such as:
|
# Make sure that URIs that contain multiple schemes, such as:
|
||||||
# swift://user:pass@http://authurl.com/v1/container/obj
|
# s3://accesskey:secretkey@https://s3.amazonaws.com/bucket/key-id
|
||||||
# are immediately rejected.
|
# are immediately rejected.
|
||||||
if uri.count('://') != 1:
|
if uri.count('://') != 1:
|
||||||
reason = _("URI Cannot contain more than one occurrence of a "
|
reason = _(
|
||||||
"scheme. If you have specified a "
|
"URI cannot contain more than one occurrence of a scheme."
|
||||||
"URI like s3://user:pass@https://s3.amazonaws.com/"
|
"If you have specified a URI like "
|
||||||
"bucket/key, you need to change it to use the "
|
"s3://accesskey:secretkey@https://s3.amazonaws.com/bucket/"
|
||||||
"s3+https:// scheme, like so: "
|
"key-id"
|
||||||
"s3+https://user:pass@s3.amazonaws.com/bucket/key")
|
", you need to change it to use the s3+https:// scheme, "
|
||||||
|
"like so: "
|
||||||
|
"s3+https://accesskey:secretkey@s3.amazonaws.com/bucket/"
|
||||||
|
"key-id"
|
||||||
|
)
|
||||||
raise exception.BadStoreUri(uri, reason)
|
raise exception.BadStoreUri(uri, reason)
|
||||||
|
|
||||||
pieces = urlparse.urlparse(uri)
|
pieces = urlparse.urlparse(uri)
|
||||||
|
@ -203,7 +207,7 @@ class Store(glance.store.base.Store):
|
||||||
|
|
||||||
self.scheme = 's3'
|
self.scheme = 's3'
|
||||||
if self.s3_host.startswith('https://'):
|
if self.s3_host.startswith('https://'):
|
||||||
self.scheme = 'swift+https'
|
self.scheme = 's3+https'
|
||||||
self.full_s3_host = self.s3_host
|
self.full_s3_host = self.s3_host
|
||||||
elif self.s3_host.startswith('http://'):
|
elif self.s3_host.startswith('http://'):
|
||||||
self.full_s3_host = self.s3_host
|
self.full_s3_host = self.s3_host
|
||||||
|
|
Loading…
Reference in New Issue