Commit Graph

210 Commits

Author SHA1 Message Date
Abhishek Kekane 781ce28560 Migrate from SQLite to Centralized db
Made provision to migrate existing cache records from
sqlite to centralized db and delete those from sqlite
after successful migration.

Implements blueprint centralized-cache-db

Change-Id: I2a840915bb6d9d72d6379cae09ebec0e51a4a6dd
2024-02-27 18:16:04 +00:00
Zuul 061e2fb4ee Merge "Deprecate Windows OS support" 2023-12-07 17:21:47 +00:00
Takashi Kajinami a8bed388f2 Deprecate Windows OS support
Unfortunately the Winstackers project has been retired because of no
maintainers[1][2], and OpenStack on Windows host is no longer
maintained.

[1] https://lists.openstack.org/pipermail/openstack-discuss/2022-November/031044.html
[2] https://review.opendev.org/c/openstack/governance/+/886880

Change-Id: Ib4c42b0619254ba4167deb9d06637a8ebdbcdec1
2023-11-27 11:33:37 +09:00
Dan Smith 6e62b872ef Add a check on startup for staging directory
If we have import methods enabled, we must have a staging directory
in order to complete those operations. This adds a startup check
for the staging directory with a warning log message if it is not
found.

Change-Id: Iac31d7f15ec6783a59b5e314883fb58f88fe2fd1
2023-03-13 19:45:36 +01:00
Han Guangyu 4e59a04d27 Update exception for property protection file
Non existing property protection file raises 500 Internal server
error. If admin/operator specifies non existing property protection
file in glance-api.conf. For example:
    [Default]
    property_protection_file = non_existing_file.yaml
    property_protection_rule_format = policies
Then create or update image. The 500 Internal server error will be
raised. But the expected result is 400 Bad Request.

Add the except of InavlidPropertyProtectionConfiguration exception,
and return 400 Bad Request.

The previous code lacks the specific process of
PropertyProtectionConfiguration exception, so it returned the common
500 error. Now, it returns 400 Bad Request.

Closes-Bug: #1905672
Change-Id: Id77010aac04aa9a4961c5bcafbf12694a0fe17c6
2022-08-01 17:40:42 +02:00
Zuul 00f453372c Merge "Immediate caching of an image" 2022-07-19 17:01:13 +00:00
Abhishek Kekane c1a2b9e221 Immediate caching of an image
Till now glance was dependent on periodic job to get image
cached locally and also has dependency on ``cachemanage``
middleware for the same.

This patch removes the periodic job and dependency of
``cachemanage`` middleware and initiates immediate caching
of an image via ``PUT /cache/image_id`` API call.

Co-Author: Dan Smith <dms@danplanet.com>

Implements: blueprint instant-caching
Change-Id: I9ab3f1b7595e22dbb03af95168314352a44eb930
2022-07-19 05:14:38 +00:00
Dharini Chandrasekar 8140abe639 Remove secure_proxy_ssl_header opt from Glance
Glance uses http-proxy-to-wsgi middleware from oslo.middleware in
its pipeline in order to efficiently forward request headers in case
of load balancer style deployments. Hence, the configuration option
``secure_proxy_ssl_header`` was marked as deprecated.

This patch removes the option and the support for it within Glance
to entirely rely on oslo middleware. This will ensure that the related
headers set by oslo.middleware:HTTPProxyToWSGI is never modified in
Glance.

Change-Id: I11d41bb736bbfd90030d88245c11642823e4c400
Closes-Bug: 1673908
2022-07-13 17:31:36 +00:00
Cyril Roelandt 1962f47ed2 Delay string interpolations at logging calls
This was already fixed in 4889dc1814 but
we did not enforce this rule and reintroduced "bad" string
interpolations. This patch adds a hacking rule to prevent us from doing
this again in the future.

Change-Id: I96d9a157d3887286542859d67138ffdae5a589f1
2022-05-14 03:17:34 +02:00
Stephen Finucane 33741138d9 Remove final six usage
We also update docs since guidance has necessarily changed here.

Change-Id: I7c24a1aa3545f3499a7a2ce30b73e2656666c764
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 16:37:20 +00:00
Stephen Finucane 6bd7c188ee Remove six.text_type, six.binary_type usage
Change-Id: I2ed464202f8b645aed11490e111c61d3c7423c11
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:00 +00:00
Takashi Kajinami 0a5b511729 Use LOG.warning instead of deprecated LOG.warn
The LOG.warn method is deprecated[1] and the LOG.warning method should
be used instead.

[1] https://docs.python.org/3/library/logging.html#logging.warning

Change-Id: Ie0cac63dedf69728392f293f4551e495aebf4d40
2022-01-19 11:36:12 +09:00
Stephen Finucane 502fa0ffc8 Remove six.iteritems usage
We also remove hacking tests for this, along with those for iterkeys and
itervalues (no usage of these).

Change-Id: If5b46580078eb756651ac6118f502eccdc693646
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-12-21 13:01:56 +00:00
Stephen Finucane 0562e3335b Remove six.add_metaclass usage
Change-Id: If0d2ad8357ea759638c6b83c04ec7a2f3cf9f6bd
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-12-21 11:38:47 +00:00
Cyril Roelandt 0ca2f92161 Fix typos
Change-Id: I5e7776324c01e467799b1296c35b84dc0c10cce2
2021-10-13 03:02:52 +02:00
Dan Smith 232177e68c Add housekeeping module and staging cleaner
As noted in previous discussions, glance should clean its staging
directory on startup. This is important for scenarios where we
started an import operation, but failed in the middle. If, when we
recover, the image has already been deleted from the database, then
we will never remove the (potentially very large) residue from disk
in our staging directory.

This is currently a problem with web-download, but will also occur
with glance-direct once we have the non-shared distributed import
functionality merged.

Closes-Bug: #1913625
Change-Id: Ib80e9cfb58680f9e8ead5993dc206f4da882dd09
2021-03-03 14:36:46 -08:00
Abhishek Kekane ffd2f5e63f Fix broken glance-cache-manage utility
glance-cahce-manage is broken due to circilar imports.
Fixed the same by importing 'prefetcher' module right before
'Prefetcher' object is initialized.

Closes-Bug: #1888349
Change-Id: I57d473572ca0a341082bacc3883cd9f763d77fa7
2020-07-23 07:04:52 +00:00
Hervé Beraud 64e3c41167 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I82b61a2d7687ff109051815e01619eb612ea9073
2020-06-02 20:14:31 +02:00
Dirk Mueller 595c1b17ff
Raise hacking to latest 2.0.0 release
We were capped at a very old version of hacking. Hacking itself caps the
various linters it uses to remain consistent, so our pep8 job was not
checking quite a bit that current versions have added.

This raises that limit to the latest to get up to the level of other
projects and addresses the errors the updated linters uncovered.

Change-Id: I89a9d73fbd59606a649e26077acebc5c42873d67
Co-authored-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-03-27 14:11:08 -05:00
Vlad Gusev d9902c26a1 Configure Glance TCP socket after the store initialization
When multiple stores are being used with rbd backend, Glance tries
to get fsid of the cluster using rados library.
If even one of the rbd backends is unavailable, glance-api wsgi fails
to start properly, but continue listening on the TCP socket and is not
responding at any request until the timeout.

This change moves socket configuration after the store initialization
to make sure that failed Glance API process will not be
considered as up by the haproxy TCP check.

Change-Id: I4298bb835ec60b79a0010e52318ada19eb24ad80
Related-Bug: #1861723
2020-02-03 22:19:38 +03:00
Erno Kuvaja 06b2465f59 Remove native ssl support
As eventlet ssl termination is broken with python 3 and
we won't be supporting python 2.7 anymore we will just
remove ssl termination to glance-api and expect the
termination being handled by something else, like HAProxy.

This patch also removes the broken ssl test job as the
non-existing feature is not broken anymore.

Change-Id: Iaf16dfcfdb3a2c93312dcad1ea1229e6b3c8caaa
2019-12-09 15:17:03 +00:00
Abhishek Kekane 6dba83ba3a Rethinking filesystem access
In Rocky multiple backend support is added as experimental feature. In
order to take advantage of this feature it is decided to deprecate
work_dir and node_staging_uri configuration options
and reserve two filesystem stores 'os_glance_tasks_store' and
'os_glance_staging_store', which can be used to get rid of initializing
store via internal functions.

These internal stores are considered "reserved stores" by Glance.
For the time being, these are hard-coded as filesystem stores.  The
store prefix 'os_glance_' is reserved for internal Glance use and
the glance-api service will refuse to start if a store with this
prefix is included in the enabled_backends config option in
glance-api.conf.

NOTE: Because there are no sensible default values for the location
of the datadir for each of these stores, the operator must define
'os_glance_tasks_store' and 'os_glance_staging_store' in
glance-api.conf configuration file as shown below.

[os_glance_tasks_store]
filesystem_store_datadir = /var/lib/glance/tasks_work_dir/

[os_glance_staging_store]
filesystem_store_datadir = /var/lib/glance/staging/

Each filesystem store must have a unique datadir.

Depends-On: https://review.openstack.org/#/c/639765/
Implements: blueprint rethinking-filesystem-access
Change-Id: I86ec513c5fc653dbb97b79d953d8430f014e684f
2019-10-01 09:53:48 +00:00
Abhishek Kekane 73fefddd96 Add periodic job to prefetch images into cache
Added new periodic job which will run as per interval set using
'cache_prefetcher_interval' configuration option and fetch images
which are queued for caching in cache directory.

DocImpact
Change-Id: If2875f7a215aca10a6ed2febc89b02219f90a10d
2019-09-10 15:01:58 +00:00
Lucian Petrut f0dc2454da Windows multiprocess wsgi
This change allows glance-api to use multiple workers on Windows
by not using fork, which is unavailable. Instead, we're duplicating
sockets and passing the handles through pipes. Also, instead of
using process groups, we have to go with Windows job objects.

Note that this doesn't change the workflow for other platforms.

A subsequent change will allow the tests to run on Windows.

blueprint windows-support

Change-Id: Ic786199844e1d804962172286905036d93a4ed14
2019-03-13 16:41:11 +02:00
Lucian Petrut 5759ec0b1c glance Windows support
This change will allow glance services to run on Windows, using
eventlet wsgi for API services.

This change will:
* avoid monkey patching the os module on Windows (which causes Popen
  to fail)
* avoiding unavailable signals
* avoid renaming in-use files or leaking handles
* update the check that ensures that just one scrubber process may
  run at a time. We can't rely on process names as there might be
  wrapper processes that have similar names (no she-bangs on Windows,
  so the scripts are called a bit differently). We'll use a global
  named mutex instead.

A subsequent change will leverage Windows job objects as a
replacement for process groups, also avoiding forking when spawning
workers.

At the moment, some Glance tests cannot run on Windows, which is
also covered by subsequent patches.

DocImpact

blueprint windows-support

Change-Id: I3bca69638685ceb11a1a316511ad9a298c630ad5
2019-03-13 16:41:11 +02:00
zhufl daf393f8fe Add missing ws seperator between words
This is to add missing ws seperator between words, usually
in log messages.

Change-Id: I1cb39a1ec1b2927d123b63c7b9df29499565e168
2018-11-19 13:46:56 +08:00
Cyril Roelandt 64904ea9c9 Do not use Accept.best_match
Accept.best_match has been deprecated, and acceptable_offers should be
used instead.

Change-Id: Ida4ee116b870f8c673f6037f81a2695a8e4dde6d
2018-10-10 18:09:47 +02:00
Brian Rosmaita 9b9d0567ef Use WebOb 1.8.1
The requirements/upper-constraints file was modified to allow WebOb
1.8.1 by commit 88bafa11deb9bd7595983d97ffabca338f073ba3.  This
patch simplifies some Glance code that could handle both WebOb
1.7.4 and 1.8.1 so that it now only handles the latter, and updates
the glance/requirements.txt and glance/lower-constraints.txt to
reflect that we support WebOb 1.8.1+ only.

Change-Id: I03e03013927cc5434aa0d97657d5e7efd8223ee5
Closes-bug: #1770410
2018-08-22 10:36:32 -04:00
Abhishek Kekane cb45edf5c8 Add multi-store support
Made provision for multi-store support. Added new config option
'enabled_backends' which will be a comma separated Key:Value pair
of store identifier and store type.

DocImpact
Depends-On: https://review.openstack.org/573648
Implements: blueprint multi-store

Change-Id: I9cfa066bdce51619a78ce86a8b1f1f8d05e5bfb6
2018-08-01 08:53:47 +00:00
Brian Rosmaita 73cc41c9ce Prepare for WebOb 1.8.1
WebOb 1.8.1 removes a function (deprecated for a long time) that
Glance uses for negotiating 'Accept-Language' headers.  The removed
function is replaced by a function that implements the "Lookup"
scheme defined in RFC 4647.

Glance wraps the webob.Request object and provides a convenience
method around the old function.  This patch uses the new webob
function in the convenience method and wraps it in such a way that
the convenience method preserves its current behavior (at least with
respect to the Glance tests).  But ... "Lookup" is compliant with RFC
7231, whereas the old function was not.  This means that given
sufficiently complex Accept-Language header values (containing
q-values), the best match under webob 1.8.1 will be different from
the best match under webob 1.7.x.  Given that the best match will,
however, be RFC 7231 compliant, this is an acceptable change.

One further complication is that the lookup() function is not
available in webob 1.7.x.  Thus this patch handles both versions.  I
suggest that as soon as WebOb===1.8.1 is merged into
lower_constraints, the code be simplified to handle 1.8.x only, and
the following release note be submitted with that patch:

Negotiation of the 'Accept-Language' header now follows the "Lookup"
matching scheme described in `RFC 4647, section 3.4
<https://tools.ietf.org/html/rfc4647.html#section-3.4>`_.  The
"Lookup" scheme is one of the algorithms suggested in `RFC 7231,
section 5.3.5
<https://tools.ietf.org/html/rfc7231.html#section-5.3.5>`_.  (This is
due to a change in an underlying library, which previously used a
matching scheme that did not conform to `RFC 7231
<https://tools.ietf.org/html/rfc7231.html>`_.)

Change-Id: Ib9735b394a134de9a53d577b4d8b5a9c760b7780
Closes-bug: #1765748
2018-04-27 16:46:14 -04:00
Erno Kuvaja 6f87c7d567 Limit default workers to 8
With modern servers it's not uncommon to see environments that has
dozens of logical processors. Glance defaults workers to number of
these logical processors seen by OS and each worker spins up pool
of 1000 threads. Having dozens of these thread pools consuming
resources is total overkill for most of the environments.

This change limits the amount of workers used by default to 8 which
should be plenty for most of the deployments. This limitation does
not affect if more workers is specifically configured in the config
file.

Change-Id: I6fcf2f8a416e34c0c719e1abd73f0525e686be5e
Closes-Bug: #1748916
2018-02-13 15:48:07 +00:00
John L. Villalovos 6e397345b1 Resolve unit test failures with going to oslo.serialization 2.3.0
openstack/oslo.serialization made a change in commit
c1a7079c26d27a2e46cca26963d3d9aa040bdbe8 which changed how
jsonutils.to_primitive() handles Exception objects. Previously the
actual Exception object would be returned but now it returns a 'repr'
of the object. This was done because CircularReferences were occuring
in some use cases with Exceptions and also in version 3.0 of
oslo.serialization they were going to raise a ValueError() for
unhandled types and this change caused Exceptions to now be handled.

The code previously would call the serialization function and if any
unknown Exception occurred it would just return action_result. With
the change to oslo.serialization an exception was no longer being
raised and thus no Exception would be raised and caught.

Now check if action_result is an Exception and if so return it.

Closes-Bug: #1728368
Change-Id: Ic374ec891a65f603433091cdae27b0d4aac8362f
2018-01-18 12:18:59 +00:00
Zuul 51f1d8b543 Merge "Replace body_file with class to call uwsgi.chunked_read()" 2017-10-19 18:25:28 +00:00
Matthew Treinish bf7887a102
Replace body_file with class to call uwsgi.chunked_read()
Since the WebOb 1.7 release webob doesn't natively support receiving
chunked transfer encoding bodies. [1] When glance is run under the
eventlet wsgi server this was fine, because eventlet will dechunk the
input on read() (or readline()) calls, so from the webob perspective
it's just a file object. However, the effort to remove the dependence
on using eventlet as the web server and deploy glance as a traditional
wsgi script we lose this mechanism. The wsgi spec doesn't provide a
consistent mechanism

When we run glance under uwsgi the uwsgi server provides an api to read
chunked data. [2] However, we need to explicitly call that api when to
dechunk the data and pass it to glance code which expects a file object.
This commit solves this issue by creating a fake file class that will
call the chunked_read() api from uwsgi on read() calls. This object is
then used if we're running the api code under uwsgi and the body has a
chunked transfer-encoding.

In conjuction with devstack change
Iab2e2848877fa1497008d18c05b0154892941589 this closes glance bug 1703856

[1] https://docs.pylonsproject.org/projects/webob/en/stable/whatsnew-1.7.html#backwards-incompatibility
[2] http://uwsgi-docs.readthedocs.io/en/latest/Chunked.html

Partial-bug 1703856

Co-Authored-By: Chris Dent <cdent@anticdent.org>

Change-Id: Idf6b4b891ba31cccbeb53d373b40fce5380cea64
2017-10-18 17:25:22 -04:00
Bernhard M. Wiedemann 877cd166b5 Avoid restarting a child when terminating
When sending a SIGTERM to the main glance-api process,
it was sending a SIGTERM to its children
but then also re-spawning its first dead child.

Closes-bug: #1714240

Change-Id: Ibef426c198d287bbdac4e764fd654edba4b7c2d6
2017-08-31 15:14:45 +02:00
Jenkins 309cf3a6ed Merge "Fix filter doesn't support non-ascii characters" 2017-07-25 21:52:59 +00:00
junboli 103463e547 Clean up the redundant code
In the file common/wsgi.py and common/config.py, the unused import
is still existed, This patch is to remove the redundant codes.

Change-Id: I7869121a2fc11b44f81b03adfd9b5807e8d08ce7
2017-06-25 05:50:49 +00:00
Dharini Chandrasekar 423f340174 Accept Range requests and set appropriate response
Currently glance v2 API incorrectly accepts ‘Content-Range’ header
for random image access and does not set response headers.
As per rfc7233, ‘Range’ requests should be accepted and ‘Content-Range’
must be returned in the response headers.

This patch enables Glance v2 API to accept the more appropriate ‘Range’
requests and sets ‘Content-Range’ response header.

For backward compatibility with pre-Pike Glance clients, the incorrect
'Content-Range' header will be accepted silently in perpetuity.
Thus this patch contains tests for 'Content-Range' in requests to
prevent regressions.

DocImpact
Implements lite-spec I5bdadde682a0c50836bd95e2a6651d6e7e18f172
Closes-Bug: #1677391

Co-Authored-By: Hemanth Makkapati <hemanth.makkapati@rackspace.com>

Change-Id: Ib7ebc792c32995751744be3f36cbc9a0c1eead2a
2017-04-05 20:40:02 +00:00
Ian Cordasco 7a843f7e1f Fix incompatibilities with WebOb 1.7
WebOb 1.7 changed [0] how request bodies are determined to be
readable. Prior to version 1.7, the following is how WebOb
determined if a request body is readable:
  #1 Request method is one of POST, PUT or PATCH
  #2 ``content_length`` length is set
  #3 Special flag ``webob.is_body_readable`` is set

The special flag ``webob.is_body_readable`` was used to signal
WebOb to consider a request body readable despite the content length
not being set. #1 above is how ``chunked`` Transfer Encoding was
supported implicitly in WebOb < 1.7.

Now with WebOb 1.7, a request body is considered readable only if
``content_length`` is set and it's non-zero [1]. So, we are only left
with #2 and #3 now. This drops implicit support for ``chunked``
Transfer Encoding Glance relied on. Hence, to emulate #1, Glance must
set the the special flag upon checking the HTTP methods that may have
bodies. This is precisely what this patch attemps to do.

[0] https://github.com/Pylons/webob/pull/283
[1] https://github.com/Pylons/webob/pull/283/files#diff-706d71e82f473a3b61d95c2c0d833b60R894

Closes-bug: #1657459
Closes-bug: #1657452
Co-Authored-By: Hemanth Makkapati <hemanth.makkapati@rackspace.com>
Change-Id: I19f15165a3d664d5f3a361f29ad7000ba2465a85
2017-03-27 22:03:36 -05:00
Dharini Chandrasekar 61d6973077 Use HostAddressOpt for opts that accept IP and hostnames
Some configuration options were accepting both IP addresses
and hostnames. Since there was no specific OSLO opt type to
support this, we were using ``StrOpt``. The change [1] that
added support for ``HostAddressOpt`` type was merged in Ocata
and became available for use with oslo version 3.22.

This patch changes the opt type of configuration options to use
this more relevant opt type - HostAddressOpt.

[1] I77bdb64b7e6e56ce761d76696bc4448a9bd325eb

Change-Id: I06e8cff035ecfaa651e215d7b18de5abc3a273c3
2017-03-09 19:48:21 +00:00
bhagyashris 8c3148b7e9 Fix filter doesn't support non-ascii characters
When non-ascii characters is passed as filter parameter to "image-list"
and "md-namespace-list" APIs then it returns HTTP 500 if glance service
is running using Python2. This is because query parameters passed to
the urlparse.urlencode method raises UnicodeEncodeError for non-ascii
characters.

Overridden params property of webob.request.BaseRequest in wsgi layer
Request class to avoid encoding of request params at several places in
case of Py2. Added a new class attribute 'encoded_params' which is
initialized to encoded params dict when params property is called for
the first time and in the subsequent calls this attribute is returned
without requiring you to worry whether the params value are encoded
or not.

Closes-Bug: #1521193
Change-Id: If4497d42820aa4b8070666d2a1a4413411557f12
2017-03-06 15:12:17 +05:30
Jenkins 6d7b15c4e4 Merge "Handling HTTP range requests in Glance" 2017-01-05 23:49:21 +00:00
Dharini Chandrasekar 400230cd9d Handling HTTP range requests in Glance
Currently Glance does not send Partial response codes while
handling HTTP range requests. Also, content length is not
appropriately set.

This patch is to send partial response code and to set the correct
content length based on the range request for image download.

Upon success status code 206 is sent and the content length is set to the
requested range.
Upon failure, there can be 2 cases:
 * If the HTTP range request for the image download is bad (For example,
   requesting download of range of bytes 10 to 50 bytes when there are only 48
   bytes), status code is set to 416 and HTTPRequestRangeNotSatisfiable is
   raised.
 * If the content range is valid, but the request is not satisfiable due to
   glance_store side erros or privacy issues, appropriate exceptions are
   raised.

APIImpact
DocImpact

Closes-Bug: #1417069
Closes-Bug: #1624508
Closes-Bug: #1399851
Closes-Bug: #1618928

Change-Id: I3cd47b998be79604511b3cd4879209820cf776b7
2016-11-22 18:07:04 +00:00
Dharini Chandrasekar 6d8870940f Improving help text for WSGI server conf opts.
Adding improved help texts for the config options to be used for
WSGI servers of the API services.

Change-Id: I8f2159f3f46a223685970548f5b6cb6f9cd34d57
Partial-Bug: #1570946
2016-08-31 20:50:48 +00:00
Jamie Lennox b0d0b1d0ba Use http-proxy-to-wsgi middleware from oslo.middleware
The HTTP_X_FORWARDED_PROTO handling fails to handle the case of
redirecting the /v1 request to /v1/ because it is handled purely by
routes and does not enter the glance wsgi code. This means a https
request is redirect to http and fails.

oslo.middleware has middleware for handling the X-Forwarded-Proto header
in a standard way so that services don't have to and so we should use
that instead of our own mechanism.

Leaving the existing header handling around until removal should not be
a problem as the worst that will happen is it overwrites an existing
'https' header value set by the middleware.

Closes-Bug: #1558683
Closes-Bug: #1590608
Change-Id: I481d88020b6e8420ce4b9072dd30ec82fe3fb4f7
2016-06-09 09:52:04 +10:00
Dina Belova 790b01573a Use OSprofiler options consolidated in lib itself
Starting with 1.0.0 osprofiler release options needed for
its workability are consolidated inside osprofiler itself.
Let's use them.

Change-Id: Ib0266e0a6e9bfa99c4bacbdca623ab1211a822eb
2016-05-25 11:33:56 +03:00
liangjingtao 208c96ab14 Normalize the options use singele quotes
Some config options in codes use double quotes
but most of the options use single quotes and
that need to be normalized

DocImpact
Closes-Bug: #1584558

Change-Id: I828326d9bb22b6cb98885255ebc0dfcc1efc0497
2016-05-23 11:33:57 +08:00
Stuart McLaren 513d717d28 Handle SSL termination proxies for version list
Return correct scheme in version URLs if service
behind an SSL termination proxy.

This is done by adding a new configuration option,
secure_proxy_ssl_header, which, when defined, makes
the wsgi application take the host_url scheme from
that header. By default, when this option is not
specified, there is no difference in behavior.

The intention is to configure any ssl-decrypting
proxy to set that header, so that glance-api knows
which protocol to use in the URLs in response.

This patch is largely based on the equivalent
nova patch: https://review.openstack.org/#/c/206479.

Partial-bug: 1558683

Change-Id: I9a9c0e42a6ad3c18d197f10095958b48d5cb879a
2016-03-21 14:36:13 +00:00
Michael Krotscheck 7a93458baa Moved CORS middleware configuration into oslo-config-generator
The default values needed for glance's implementation of cors
middleware have been moved from paste.ini into the configuration
hooks provided by oslo.config. Furthermore, these values have been
added to glance's default configuration parsing. This ensures
that if a value remains unset in glance-api.conf, it will be set to use
sane defaults, and that an operator modifying the configuration
file will be presented with a default set of necessary sane headers.

Change-Id: I3c9d267b6224d6c7e5cc2c41cb51fb7e363c4955
Closes-Bug: 1551836
2016-03-02 07:48:05 -08:00
Jenkins 8cef14ed40 Merge "Encode headers to launch glance v2 on mod_wsgi" 2016-03-02 00:12:23 +00:00